cocos2d-x 2.0以上设置横竖屏的方法

函数所在目录:Cocos2d-x项目目录iOS目录中的RootViewController.mm文件中

默认是横屏

函数一:

(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {

//    return UIInterfaceOrientationIsLandscape( interfaceOrientation );

    return (UIInterfaceOrientationIsPortrait( interfaceOrientation ));

}

函数二:

- (NSUInteger) supportedInterfaceOrientations{

#ifdef __IPHONE_6_0

//    return UIInterfaceOrientationMaskLandscape;

     return UIInterfaceOrientationMaskPortrait;

// 这里我设置的时候UIInterfaceOrientationMaskPortrait总是出不来,cocos2d-x好像经常有这样的情况,我把别人的项目里的这行代码复制过来才好

#endif

}

原文地址:https://www.cnblogs.com/yy3026906/p/3159257.html