在做游戏中,碰到了要改变手机屏幕横竖屏幕的问题,所以这里做个记录。
在自己的项目中找到RootViewController.m 类(目前版本是1.0),然后找到宏定义的一段代码,代码如下:
#elif GAME_AUTOROTATION == kGameAutorotationUIViewController
他下面这行就是Cocos2D中设置横屏幕的代码
return ( UIInterfaceOrientationIsLandscape( interfaceOrientation ) ); //横
然后修改成
return ( UIInterfaceOrientationIsPortrait ( interfaceOrientation ) ); //竖