我很难让我的应用程序正确支持所有的方向。 问题在于启动。我已经做了以下步骤:iPad初始定位
补充:
<key>UISupportedInterfaceOrientations</key> <array> <string>UIInterfaceOrientationPortraitUpsideDown</string> <string>UIInterfaceOrientationLandscapeLeft</string> <string>UIInterfaceOrientationLandscapeRight</string> <string>UIInterfaceOrientationPortrait</string> </array>
- 确信,我的所有视图控制器始终shouldAutorotateToInterfaceOrientation返回YES
- 添加所有默认*图像
在风景中 - 应用程序开始显示正确的默认图像,但实际应用程序以纵向开始。不会调用willRotate ...和shouldAutorotate ..方法。
我甚至试过(从WordPress的)的混写方法:
+ (void)youWillAutorotateOrYouWillDieMrBond {
NSLog(@"youWillAutorotateOrYouWillDieMrBond");
Swizzle([NSClassFromString(@"UISplitViewController") class], @selector(shouldAutorotateToInterfaceOrientation:), @selector(MyShouldAutorotateToInterfaceOrientation:), NULL);
Swizzle([NSClassFromString(@"UIViewController") class], @selector(shouldAutorotateToInterfaceOrientation:), @selector(MyShouldAutorotateToInterfaceOrientation:), NULL);
}
- (BOOL)MyShouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
NSLog(@"MyShouldAutorotateToInterfaceOrientation (%@)", self);
return(YES);
}
没有运气
也。无论我做什么 - 如果设备处于横向模式,该应用程序将以肖像开始。
我已阅读相应的Apple文档 - 他们说应用程序总是以纵向开始,但如果VC支持方向,则会自行旋转。所以,我似乎正在尽我所能...
真的出于这里的想法,将不胜感激任何见解。
它应该工作(并且它适用于我的项目)。启动时的视图层次结构究竟是什么样的? – Anomie 2011-05-08 12:31:08
这是一个由iPad模板构建的标准应用程序,我有一个分割视图控制器,所以在启动时显示vc细节,并在工具栏上打开主vc。 – reflog 2011-05-08 12:51:07