【发布时间】:2011-03-17 21:05:56
【问题描述】:
我正在使用 iPad。我希望我的应用程序仅在横向模式下修复。我的应用包含一个拆分视图控制器,在拆分视图控制器上方我放置了登录屏幕。
在用户提供必要的用户名和密码后,登录视图应该被删除,以便拆分视图控制器被打开。它运作良好。但我希望将登录屏幕设置为横向模式。我尝试了很多方法,但我的问题仍然没有解决。我在 plist 中放置了一个带有 value lanscape 的 UIOrientaion 键。但是没用。
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
//UIInterfaceOrientationLandscapeLeft;
// Overriden to allow any orientation.
// return UIInterfaceOrientationIsLandscape(interfaceOrientation);
return YES;
//return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft);
}
我也尝试过这种方式,但没有结果。
[[UIDevice currentDevice] setOrientation:UIInterfaceOrientationLandscapeLeft];
在viewdidload中也是这样,
通过使用这种方式,我可以将应用程序设置为横向模式,但视图不会旋转到横向。登录视图固定在 potrait 模式。
在 nib 文件中,如果我在 lanscape 中修复视图,则拆分视图的 rootviewcontroller 出现在 e 侧和 splitviewcontroller 的 detailviewcontroller 中,此登录屏幕也在 potrait 模式下打开.....
任何帮助将不胜感激 提前致谢
【问题讨论】:
-
不存在用于在 plist 中设置的 UIOrientation 键您在 plist 中究竟尝试过什么键?
-
初始界面方向是关键,其值为横向模式
-
我找到了一个未调用 shouldAutorotateToInterfaceOrientation 方法的原因。可能是这个原因,谁能建议我哪里出错了?
标签: uisplitviewcontroller landscape ios-simulator