我在iOS6中遇到自动旋转和方向问题。它们不像以前在iOS5中那样工作。这是一个示例代码。
implementation mainProgram
// view controller is defined in landscape mode (.xib file)
// The preferredInterfaceOrientationForPresentation and supportedInterfaceOrientations have not been defined because they give me problems with getting the orientation right of other calling classes
-(IBAction)somButtonPressed:(id)sender{
[self presentViewController:inputText animated:NO completion:nil];
}
@end
/////////////////////////////////////////////////////////
// This has has several UITextField
// The view of this controller is defined as landscape in .xib
implementation inputText
- (void)viewDidLoad
{
[super viewDidLoad];
}
- (BOOL)shouldAutorotate {
return YES;
}
#if 0 // Disabled
- (NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationLandscapeRight;
}
#endif
#if 1 // Enabled
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
return UIInterfaceOrientationLandscapeRight;
}
#endif
@end
问题/观察: 1.如果在inputText中启用supportedInterfaceOrientations且返回值为UIInterfaceOrientationLandscapeRight,则程序将失败,表示preferredInterfaceOrientationForPresentation正在尝试设置为无效的方向,即使与supportedInterfaceOrientations中的方向完全相同
在我看来,它们都是ios6中的所有错误。还有其他人遇到过这些问题吗?