Ter*_*ium 23 landscape orientation ios game-center ios6
问题:如果用户未登录GameCenter帐户 - GameCenter身份验证视图以纵向模式启动(在ios 5中有一个模式对话框)要求登录.但是如果我在xcode(项目摘要)或supportedInterfaceOrientationsForWindow中禁用纵向模式: (因为我的应用程序应该只在横向模式下运行)我得到:
由于未捕获的异常'UIApplicationInvalidInterfaceOrientation'而终止应用程序,原因:'支持的方向与应用程序没有共同的方向,并且shouldAutorotate返回YES'
如果我为ipad/iphone启用了肖像(和/或注释掉了supportedInterfaceOrientationsForWindow :),它可以正常工作而不会崩溃,但我不希望启用纵向模式.
Ter*_*ium 27
在写这个问题,并与实验代码,似乎我已经找到了解决方案:能够在项目总结所有方向和删除应用程序:supportedInterfaceOrientationsForWindow.
将此代码添加到ViewController:
- (NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskLandscape;
}
Run Code Online (Sandbox Code Playgroud)
现在它无缝地工作.
小智 6
添加到app delegate:
- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)w {
return (NSUInteger)[application supportedInterfaceOrientationsForWindow:w] | (1<<UIInterfaceOrientationPortrait);
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
13283 次 |
| 最近记录: |