键盘方向在ios6中无法正常工作

时间:2012-11-10 17:59:32

标签: keyboard ios6

我在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中的方向完全相同

  1. 当我尝试在inputText的UITextField之一上输入文本时,键盘以纵向模式而不是LandscapeRight出现。 inputText控制器的视图在landscapeRight方向上很好。
  2. 在我看来,它们都是ios6中的所有错误。还有其他人遇到过这些问题吗?

0 个答案:

没有答案