mainActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);//竖屏

竖屏是JAVA代码

另外再改动COCOS2D-X坐标系统(C++代码)(20140602这是ANDROID和IOS都须要的):

CCEGLView *view = CCEGLView::sharedOpenGLView();
CCSize czFrame = view->getFrameSize();
view->setFrameSize(czFrame.height,czFrame.width);
view->setDesignResolutionSize(320,480,kResolutionExactFit);

设置回来代码和上面的相反

设置android-14转屏就崩溃,设置android-11就不崩溃,不知道为什么。

(20140511)

20140602总结IOS下要做的事:

设备旋转不要打钩:

在RootViewController里,代码控制是否旋转,你要改动这些代码来适应你自己的程序:

- (BOOL) shouldAutorotate {
bool bIsPortraitCur = ( self.interfaceOrientation == UIInterfaceOrientationPortrait );
if( bIsPortraitCur != s_needOrientation )
return YES;
else
return NO;
return YES;
// return NO;
}
// For ios6, use supportedInterfaceOrientations & shouldAutorotate instead
- (NSUInteger) supportedInterfaceOrientations{
#ifdef __IPHONE_6_0
return UIInterfaceOrientationMaskAll;
#endif
}

旋转的IOS代码:

extern bool s_needOrientation;
bool SetScrnOrentation( bool bIsPotrit ){
if(s_needOrientation == bIsPotrit )
return false; s_needOrientation = bIsPotrit ;
[[UIDevice currentDevice] performSelector:@selector(setOrientation:)
withObject:
bIsPotrit ? (id)UIDeviceOrientationPortrait : (id)UIDeviceOrientationLandscapeRight];
//[[UIApplication sharedApplication] setStatusBarOrientation:bIsPotrit?UIInterfaceOrientationPortrait:UIInterfaceOrientationLandscapeRight]; return true;
}

COCOS2D-X暂时设置竖屏,过一阵子再设置回横屏的更多相关文章

  1. Android设置竖屏

    Android设置竖屏(禁止旋转屏) 清单文件,Activity下添加属性 android:screenOrientation="portrait" 如下 <?xml ver ...

  2. 3.20 内存及效率的一些总结 3.21 设置竖屏 3.22 CCLOG与CCLog区别

    3.20 内存及效率的一些总结 3.21 设置竖屏 1.android AndroidManifest.xml文件中, screenOrientation="landscape" ...

  3. iOS设置竖屏,播放视频可以任性旋转的解决方法,亲测可用

    之前在网上找了很多方法,都是强制横屏,但是如果设备关闭旋转锁定,强制横屏后把设备竖立起来,播放器也会跟着竖过来,但是就回不去了.现在项目要求让app默认都是竖屏,只有在全屏播放的时候可以自由旋转,于是 ...

  4. Android模拟器设置竖屏

    使用Android模拟器測试自己开发的程序时,有时候会发现屏幕为横屏显示,查看效果非常不方便. 这里记录了一种禁止横屏的方法. 在文件  Mainfest.xml 中,在须要禁止横屏的 activit ...

  5. XCode设置竖屏

    选中你的项目,在General这个标签内,Deoployment info的这个分组,有一个Device Orientation 标签,内有一个Portrait的选项,选中是竖屏,取消选中是横屏

  6. Android时时监測手机的旋转角度 依据旋转角度确定在什么角度载入竖屏布局 在什么时候载入横屏布局

    一.场景描写叙述: 最近开发中遇到个问题,就是我们在做横竖屏切换的功能时.横竖屏布局是操作系统去感知的,作为开发员没法确定Activity在什么时候载入横屏布局,在什么时候载入竖屏布局.因此为了找到载 ...

  7. uniapp设置竖屏

    //在APP.vue中的onLaunch钩子写入plus.screen.lockOrientation('portrait-primary');

  8. Android 动态的给Button、TextView、ImageView等控件设置了background后,再设置padding属性时该属性不起作用

    也许大家遇到这样一个问题,有时我们根据业务需要在一个ViewGroup中动态的(程序运行过程中)添加View.例如添加Button,就需要给Button添加background.padding.mar ...

  9. Android之设置横屏竖屏

    方案一:在AndroidManifest.xml中配置 在项目的AndroidManifest.xml中找到你所指定的activity中加上Android:screenOrientation属性,它有 ...

随机推荐

  1. c++ string 解析ip

    比如输入是192.168.80.12-15,解析成192.168.80.12.192.168.80.13.192.168.80.14.192.168.80.15. #include <iostr ...

  2. Cosine Similarity of Two Vectors

    #include <iostream>#include <vector>#include <cmath>#include <numeric> templ ...

  3. bzoj 1468 Tree(点分治模板)

    1468: Tree Time Limit: 10 Sec  Memory Limit: 64 MBSubmit: 1527  Solved: 818[Submit][Status][Discuss] ...

  4. python大杂铺

      python中continue,break,return三者之间的区别 return 会直接令函数返回,所有该函数体内的代码都不再执行了,所以该函数体内的循环也不可能再继续运行. break:跳出 ...

  5. tp3.2 复合查询or

    tp3.2 复合查询or $where['goods_name'] = array("like","%$q%");$where['goods_sn'] = ar ...

  6. caffe介绍

  7. 辨析 singleton 和 prototype

    <bean id="person1" class="com.bean.life.Person"> <property name="n ...

  8. .htaccess的基本用法与介绍

    ●自定义错误页 .htaccess的一个应用是自定义错误页面,这将使你可以拥有自己的.个性化的错误页面(例如找不到文件时),而不是你的服务商提供的错误页或没有任何页面.这会让你的网站在出错的时候看上去 ...

  9. JavaScript 继承代码中,B.prototype = new A(); 的含义是什么?[转自知乎]

    假设有如下代码: function A() {this.name = "A"} function B() {this.name = "B"} A.prototy ...

  10. Caffe+Kubuntu16.04_X64+CUDA 8.0配置

    前言: 经过尝试过几次Caffe,theano,MxNet之后,很长时间没有进行caffe的更新,此次在Ubuntu16.04下安装Caffe,折腾了一天时间,终于安装成功. 参考链接:Caffe+U ...