微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

cocos2d-x如何切换横竖屏

IOS:

找到项目IOS/RootViewController.mm

修改

- (NSUInteger) supportedInterfaceOrientations{
#ifdef __IPHONE_6_0
    //横版
    //return UIInterfaceOrientationMaskAllButUpsideDown;
    //竖版
    return UIInterfaceOrientationMaskPortrait;
#endif
}
我将原来的横版改成了竖版
 

另外我们需要改一下项目,点击你的项目,选择General选项。修改Device Orientation

其中 portrait //竖版

landscape //横版,横版需要left和right都勾选

搞定IOS版本


android:

android比较简单,直接修改项目proj.android/AndroidManifest.xml

android:screenorientation="portrait" //竖版

android:screenorientation = "landscape" //横版

原文地址:https://www.jb51.cc/cocos2dx/341456.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐