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"

cocos2dx怎样设置ios和Android横屏竖屏的几种方法的更多相关文章

  1. Android横屏竖屏切换的问题

    Android横屏竖屏切换的问题 http://blog.sina.com.cn/s/blog_77c632410101790w.html

  2. Android横屏竖屏设置

    Android横竖屏设置: 方法一:onCreate()中 setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); // ...

  3. 转载:Android横屏竖屏切换的问题

    一.禁止横竖屏转换 Android横竖屏切换在手机开发中比较常见,很多软件在开发过程中为了避免横竖屏切换时引发不必要的麻烦,通常禁止掉横竖屏的切换, 通过在AndroidManifest.xml中设置 ...

  4. 禁止Android 横屏竖屏切换

    在Android中要让一个程序的界面始终保持一个方向,不随手机方向转动而变化的办法: 只要在AndroidManifest.xml里面配置一下就可以了. 在AndroidManifest.xml的ac ...

  5. 【转】Android 模拟器横屏竖屏切换设置

    http://blog.csdn.net/zanfeng/article/details/18355305# Android 模拟器横屏竖屏切换设置时间:2012-07-04   来源:设计与开发   ...

  6. Android之横屏竖屏显示问题

    1.採用不同的布局文件 在res下创建目录layout-land 在该目录下写入的layout(xml文件)横屏的时候系统自己主动选择显示的layout 同理: 在res下创建目录layout-por ...

  7. RK3288 6.0 双屏异显,横屏+竖屏【转】

    本文转载自:http://blog.csdn.net/clx44551/article/details/78215730?locationNum=8&fps=1 RK3288 6.0 双屏异显 ...

  8. Android强制横屏+全屏的几种常用方法

    全屏: 在Activity的onCreate方法中的setContentView(myview)调用之前添加下面代码 1 requestWindowFeature(Window.FEATURE_NO_ ...

  9. js 横屏 竖屏 相关代码 与知识点

    <!DOCTYPE html> <html> <head> <title></title> </head> <body&g ...

随机推荐

  1. c# 通过解析mp3规范命名并上传服务器

    引用using Shell32; private void Open_Click(object sender, RoutedEventArgs e) { OpenFileDialog ofd = ne ...

  2. C++ 中的比較函数

    在敲代码的时候,排序是一种和经常使用的算法.在排序中.比較又是当中最经常使用的操作.这里,我们来分析一下C++中的比較问题. 当中,基本数据类型int. float.string等已经提供了默认的比較 ...

  3. hdu - 4975 - A simple Gaussian elimination problem.(最大流量)

    意甲冠军:要在N好M行和列以及列的数字矩阵和,每个元件的尺寸不超过9,询问是否有这样的矩阵,是独一无二的N(1 ≤ N ≤ 500) , M(1 ≤ M ≤ 500). 主题链接:http://acm ...

  4. USACO comehome Dijkstra

    USER: Kevin Samuel [kevin_s1] TASK: comehome LANG: C++ Compiling... Compile: OK Executing... Test 1: ...

  5. Android呼叫开发系列WebService

    我在学习Android第一个问题是在发展进程中遇到Androidclient究竟是怎么用server与数据库交互它?问题是,我有初步接触Android这困扰了我一个非常大的问题.天直到几年前,我突然想 ...

  6. Xamarin.Android 入门实例(2)之实现WCF 寄宿于IIS 的Web服务提供

    1.WCF 契约 ICalculator.cs using System.ServiceModel; namespace Contracts { [ServiceContract] public in ...

  7. CSU 1659: Graph Center(SPFA)

    1659: Graph Center Time Limit: 1 Sec  Memory Limit: 128 MB Submit: 63  Solved: 25 [id=1659"> ...

  8. offsetTop和scrollTop差异

    最近写组件,这两个属性的结果搞的有点晕,我检查的文件及资料,这两个性质如下面总结: 他一直在offsetLeft.offsetTop,scrollLeft.scrollTop这些方法都是非常迷茫,花一 ...

  9. 解决PhpCms V9后台无法上传图片

    PHPCMS V9 在近期一次更新的版本号(9.4.2)中因为代码推断失误.导致PHPCMS在后台更新文章无法上传图片而导致的bug.在PHPCMS论坛中找到了暂时解决方式,希望PHPCMS官方能尽快 ...

  10. sql pivot、unpivot和partition by用法

    原文:sql pivot.unpivot和partition by用法 演示脚本 from sys.sysobjects where name = 'Student' AND type = 'U') ...