Cocos2d纵向模式在iPhone上不工作 [英] Cocos2d portrait mode not working on iPhone
问题描述
我正在建立一个cocos2d游戏,应该是在纵向模式。我改变了RootViewController.m到纵向模式,一切工作正常,无论是在模拟器和我的iPad。
I'm building a cocos2d game which is supposed to be in portrait mode. I changed the RootViewController.m to portrait mode, and everything works fine, both on the simulator and on my iPad. However, when I run the game on my iPhone, it defaults back to landscape mode.
有关如何解决这个问题的任何想法?
Any ideas on how to fix this?
谢谢。
推荐答案
我有一个更好的解决方案,可以100%工作:
I have a better solution that will work 100%:
使用以下命令替换RootViewController.m /
中的所有东西:shouldAutorotateToInterfaceOrientation方法:
Replace all the stuff that was in the RootViewController.m / shouldAutorotateToInterfaceOrientation Method with following:
return(UIInterfaceOrientationIsPortrait(interfaceOrientation));
return ( UIInterfaceOrientationIsPortrait( interfaceOrientation ) );
如果我想在运行时切换场景改变方向: p>
And if I ever want to change the orientation during runtime / switching scene:
[[CCDirector sharedDirector] setDeviceOrientation:CCDeviceOrientationLandscapeLeft];
[[CCDirector sharedDirector] setDeviceOrientation:CCDeviceOrientationLandscapeLeft];
请注意,自动轮播现在支持的时间较长
Note that Auto Rotation is now on longer supported
这篇关于Cocos2d纵向模式在iPhone上不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!