iphone - Cocos2d 肖像模式在 iPhone 上不起作用

标签 iphone xcode ios cocos2d-iphone

我正在构建一个应该处于纵向模式的 cocos2d 游戏。我将 RootViewController.m 更改为纵向模式,并且在模拟器和我的 iPad 上一切正常。但是,当我在 iPhone 上运行该游戏时,它会默认返回横向模式。

关于如何解决这个问题有什么想法吗?

谢谢。

最佳答案

我有一个 100% 有效的更好的解决方案:

替换 RootViewController.m 中的所有内容/ shouldAutorotateToInterfaceOrientation 方法如下:

return ( UIInterfaceOrientationIsPortrait( interfaceOrientation ) );

如果我想在运行时/切换场景时改变方向:

[[CCDirector sharedDirector] setDeviceOrientation:CCDeviceOrientationLandscapeLeft];

请注意,自动旋转现在不再受支持

关于iphone - Cocos2d 肖像模式在 iPhone 上不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5987066/

相关文章:

iphone - 在没有 UIWebView 的情况下播放 YouTube 链接的视频

iphone - 如何在运行时以编程方式找出应用程序 ID?

android - 使用手机摄像头作为 GWT 的扫描仪?

ios - Swift2 中 ALCameraViewController 的语法错误

iphone - 删除应用程序后按下 CFUUIDRef

iphone - UIWebView 和 Safari 渲染不同

iphone - 如何在 iPhone sdk 中将 NSData 转换为 pdf?

iphone - 为什么我的 iPhone 应用程序没有显示在 iPad App Store 上?

xcode - 未迁移到沙箱

ios - 具有 self 类型转换的 Swift 通用扩展