Cocos2d-x 设置竖屏的方法 2.0以上版本
来源:互联网 发布:sql导入powerdesigner 编辑:程序博客网 时间:2024/05/22 17:14
在网上搜了千百遍终于终于找到对的方法了。。
在网上搜的大部分结果是把(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation();函数中的语句改成如注释掉的:
(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
returnUIInterfaceOrientationIsLandscape( interfaceOrientation );
// return (UIInterfaceOrientationIsPortrait( interfaceOrientation ));
}
可是在本人机子上做实验就是不成功。。。我的cocos2d的版本是2.1beta3-x-2.1.1
最终正确的方法如下:不是修改上面的函数而是把(NSUInteger) supportedInterfaceOrientations();函数中的语句改成注释掉的
- (NSUInteger) supportedInterfaceOrientations{
#ifdef __IPHONE_6_0
returnUIInterfaceOrientationMaskLandscape;
// return UIInterfaceOrientationMaskPortrait;
#endif
}
这样实验就成功了。。。
两函数所在目录:Cocos2d-x项目目录iOS目录中的RootViewController.mm文件中。。。
如果你试验还是不成功试着把RootViewController.mm文件中的如下3个函数全部改成注释掉的部分:
函数一:
(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;
}
- Cocos2d-x 设置竖屏的方法 2.0以上版本
- Cocos2d-x 设置竖屏的方法 2.0以上版本
- Cocos2d-x 设置竖屏的方法 2.0以上版本
- Cocos2d-x 设置竖屏的方法 2.0以上版本
- Cocos2d-x 设置竖屏的方法 2.0以上版本
- Cocos2d-X 3.0以上版本屏幕适配的方法
- cocos2d-x 设置竖屏的方法
- Cocos2d-x 3.3版本及以上版本CCPointZero的改变
- Cocos2D-x 2.0以上版本跨Android开发环境的搭建---------------------cocos2d-x 3.0正式版本(7.2)
- IOS Cocos2d-x 设置竖屏的方法
- express 4.X.X版本 npm版本3.X.X版本以上 没有layout.js文件的解决方法 页面布局设置的方法
- cocos2d-x读取xml(适用于cocos2d-x 2.0以上版本)
- Cocos2d-x 2.x设置竖屏方法 android ios
- EXTJS4.x以上的版本中没有dolayout这个方法
- Windows安装ElasticSearch5.x以上版本以及插件的方法
- 使用Cocos Code IDE设置Quick-Cocos2d-x 3.2-RC1版本语法提示的方法
- [寒江孤叶丶的Cocos2d-x之旅_13]Cocos2d-x 3.2版本以上LUA脚本加密解决方案【12.19更新】
- [寒江孤叶丶的Cocos2d-x之旅_14]Cocos2d-x 3.2版本以上LUA脚本Socket通讯解决方案——LuaSocket
- .NET DropdownList 不同条目设置背景色和字体颜色
- 最小生成树kruskal 并查集合 模板题
- SpringMVC配置
- Hibernate级联删除——JPA下的Hibernate实现一对多级联删除CascadeType.DELETE_ORPHAN基于注解方式
- 14条建议,使你的IT职业生涯更上一层楼
- Cocos2d-x 设置竖屏的方法 2.0以上版本
- I - Constructing Roads
- Java设计模式透析之 —— 适配器(Adapter)
- POI EXCEL 数据导出
- JPA注解
- Linux 下搭建流媒体服务器
- SSH中连上 oracle
- < Linux Kernel > Measuring Time
- Linux内核设备驱动模块自动加载机制