Keyboard 键盘方向在ios6中无法正常工作
我在iOS6中遇到了自动旋转和定向问题。它们在iOS5中不再像以前那样工作。下面是一个示例代码Keyboard 键盘方向在ios6中无法正常工作,keyboard,ios6,Keyboard,Ios6,我在iOS6中遇到了自动旋转和定向问题。它们在iOS5中不再像以前那样工作。下面是一个示例代码 implementation mainProgram // view controller is defined in landscape mode (.xib file) // The preferredInterfaceOrientationForPresentation and supportedInterfaceOrientations have not been defined becaus
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,返回值为UIInterfaceOrientationAndscapeRight,则程序将无法说明preferredInterfaceOrientationForPresentation试图设置为无效的方向,即使该方向与supportedInterfaceOrientations中的方向完全相同