iphone:点击按钮将旋转视图
尝试手动旋转视图时出现问题。例如,我有一个在横向运行的视图控制器,在该视图上有一个按钮。我想点击该按钮,强制视图旋转到纵向(倒立纵向)。我搜索了一下,但找不到答案 感谢您的帮助您可以尝试以下方法:iphone:点击按钮将旋转视图,iphone,rotation,uiinterfaceorientation,Iphone,Rotation,Uiinterfaceorientation,尝试手动旋转视图时出现问题。例如,我有一个在横向运行的视图控制器,在该视图上有一个按钮。我想点击该按钮,强制视图旋转到纵向(倒立纵向)。我搜索了一下,但找不到答案 感谢您的帮助您可以尝试以下方法: - (void)buttonPressed { // check current orientation if ([[UIApplication sharedApplication] statusBarOrientation] != UIDeviceOrientationLandsc
- (void)buttonPressed {
// check current orientation
if ([[UIApplication sharedApplication] statusBarOrientation] != UIDeviceOrientationLandscapeLeft) {
// no, the orientation is wrong, we must rotate the UI
self.view.userInteractionEnabled = NO;
// setup status bar
[[UIApplication sharedApplication] setStatusBarOrientation:UIDeviceOrientationLandscapeLeft animated:NO];
// rotate main view, in this sample the view of navigation controller is the root view in main window
[self.view setTransform: CGAffineTransformMakeRotation(M_PI / 2)];
// set size of view
[self.view setFrame:CGRectMake(0, 0, 748, 1024)];
}
}
你能发布你有问题的代码吗?对不起,这只是个想法,我还没有代码。对不起,我回复晚了,你的答案是正确的。非常感谢。:-)如何在通用应用程序(iPhone4/5、iPad/iPad视网膜/iPad迷你版)中找到框架尺寸?