cocos2dx如何设置ios和Android横屏竖屏的几种方法
来源:互联网 发布:网络的消极影响 编辑:程序博客网 时间:2024/06/09 13:50
cocos2d-x编译到ios上,默认是横屏的,若要改为http://竖屏,不同的ios版本,方法也会不同
在ios7上也许我们设置好了横竖屏,但到了ios6上也许会变化。下面白白给大家分享一下我的做法
转载请注明地址http://blog.csdn.net/u010229677
1、通用的
只需要在RootViewController.mm文件里面
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return UIInterfaceOrientationIsPortrait( interfaceOrientation );}// For ios6, use supportedInterfaceOrientations & shouldAutorotate instead- (NSUInteger) supportedInterfaceOrientations{#ifdef __IPHONE_6_0 return UIInterfaceOrientationMaskPortrait;#endif}- (BOOL) shouldAutorotate { return NO;}
————也可以这么做—————
if ([[UIDevice currentDevice] respondsToSelector:@selector(setOrientation:)]) {[[UIDevice currentDevice] performSelector:@selector(setOrientation:) withObject:(id)UIInterfaceOrientationPortrait];}}//但是- (BOOL) shouldAutorotate { return NO;}//一定要返回no
另外,需要在项目的General属性Deployment Info的Portrait前面选中
2、可以设置view与电池条方向保持一致在AooController.mm中
<span style="font-size:18px;">- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions </span>
这个函数中加一句话
[[UIApplication sharedApplication] setStatusBarOrientation:UIDeviceOrientationPortrait animated: NO];
android项目修改为横屏的方法是修改xml文件:
在AndroidManifest.xml中设置
android:screenOrientation="portrait"
0 0
- cocos2dx如何设置ios和Android横屏竖屏的几种方法
- Android和iOS中Cocos2dx的横屏竖屏设置
- Android和iOS中Cocos2dx的横屏竖屏设置
- Android和iOS中Cocos2dx的横屏竖屏设置
- Android和iOS中Cocos2dx的横屏竖屏设置
- cocos2d:Android和iOS中Cocos2dx的横屏竖屏设置
- Android和iOS中Cocos2dx的横屏竖屏设置
- Android和iOS中Cocos2dx的横屏竖屏设置
- Android和iOS中Cocos2dx的横屏竖屏设置
- Android和iOS中Cocos2dx的横屏竖屏设置
- Android和iOS中Cocos2dx的横屏竖屏设置
- Android设置颜色的几种方法
- Android设置颜色的几种方法
- android 闹钟设置的几种方法
- Android : 颜色设置的几种方法
- cocos2dx输出Log的几种方法
- cocos2dx输出Log的几种方法
- cocos2dx输出Log的几种方法
- struts拦截器的详解
- lua与C++相互调用
- hello Ruby on rails
- oracle 左连接 右连接 全连接
- Java集合源码学习(22)_NavigableMap接口的实现TreeMap
- cocos2dx如何设置ios和Android横屏竖屏的几种方法
- C语言空心菱形 *号打印图形
- POJ 3299 Humidex(水题)
- Base64笔记
- 江苏金湖大华自动化仪表有限公司 公司简介
- Android之Socket的基于UDP传输的创建步骤
- 个人联系方式
- poj 百练2950 摘花生
- UVa-729-The Hamming Distance Problem