1. 程式人生 > >cocos2d-x ios 設定橫屏/豎屏(全)

cocos2d-x ios 設定橫屏/豎屏(全)

Cocos2d-x專案\iOS\RootViewController.mm檔案中。

以下方法任選其一即可…      本人機子函式二ok!

函式一:

(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {

    return UIInterfaceOrientationIsLandscape( interfaceOrientation );

//    return (UIInterfaceOrientationIsPortrait( interfaceOrientation ));

}

函式二:

- (NSUInteger) supportedInterfaceOrientations{

#ifdef __IPHONE_6_0

    return UIInterfaceOrientationMaskLandscape;

//     return UIInterfaceOrientationMaskPortrait;

//    直式顯示: protrait

//    橫式顯示: landscape

#endif

}

函式三:

- (BOOL) shouldAutorotate {

    returnYES;

//    return NO;

}

還有最後關鍵的一點:

用xcode肯定知道在哪裡!這裡是螢幕和內容關係,模擬器圖也有。