如果您可以登录 Apple 开发论坛,看看这个线程 https://devforums.apple.com/message/727235.
基本上,这是对我有帮助的信息:
1.我必须设置window.rootViewController = mainViewController
in
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
2.对于视图控制器,其中
- (BOOL)shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation)interfaceOrientation
didn't就回来YES
,我必须添加
- (NSUInteger)supportedInterfaceOrientations
返回相同的值
3. Added
- (BOOL)shouldAutorotate {
return YES;
}
- (NSUInteger)supportedInterfaceOrientations {
return (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscapeLeft |
UIInterfaceOrientationMaskLandscapeRight | UIInterfaceOrientationMaskPortraitUpsideDown);
}
到 mainViewController.m
4. Added
- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
return (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscapeLeft |
UIInterfaceOrientationMaskLandscapeRight | UIInterfaceOrientationMaskPortraitUpsideDown);
}
appDelegate.m(我相信这是可选的,用于设置默认值,以防应用程序的 Info.plist 文件或单个视图控制器中未指定它们)
因为我希望我的代码向后兼容回 3.0,所以我没有使用All方向掩码,因为我需要使用 XCode 4.3 进行编译