quick-cocos2d 設置橫屏

quick cocos2d新建項目,在xcode中 起模擬器,默認的是豎屏,我想作一個橫屏的遊戲,前面已經說了ios

 

選中你的項目,在General這個標籤內,Deoployment info的這個分組,有一個Device Orientation 標籤,內有一個Portrait的選項,選中是豎屏,取消選中是橫屏c++

 

這裏的橫屏豎屏只是你顯示的狀態,而並不是是你擺放遊戲資源或者寫代碼按照座標排布的橫屏,這時候要設置Landscape Right,可是選中之後,就會直接崩潰xcode

 

int main(int argc, char *argv[]) {app

    NSAutoreleasePool *pool = [NSAutoreleasePool new];ui

    int retVal = UIApplicationMain(argc, argv, nil, @"AppController");//會崩潰在這一句 spa

    [pool release];code

    return retVal;遊戲

 

 

Terminating app due to uncaught exception 'UIApplicationInvalidInterfaceOrientation', reason: 'Supported orientations has no common orientation with the application, and [RootViewController shouldAutorotate] is returning YES'資源

libc++abi.dylib: terminating with uncaught exception of type NSExceptionit

這裏的緣由也已經講清楚了,是你的初始化不支持橫屏,咱們須要作一個修改

 

在RootViewController.mm  中

 

// For ios6.0 and higher, use supportedInterfaceOrientations & shouldAutorotate instead

- (NSUInteger) supportedInterfaceOrientations

{

//加上這一句,而後試一下,一切 ok     

return UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight;

#ifdef __IPHONE_6_0

    return UIInterfaceOrientationMaskPortrait;

#endif

}

相關文章
相關標籤/搜索