Cocos2dx how to set up iOS and Android horizontal screen vertical screen several ways

Source: Internet
Author: User

The cocos2d-x is compiled onto iOS. The default is a horizontal screen, to change to http://Vertical screen. Different iOS version numbers. Methods can also be different

On The iOS7, perhaps we set the screen. But it may change on the IOS6. Here 's What I'm doing for you.

Reprint Please specify address

1, the General

just need to the file's face

-(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;}

———— can do the same —————

if ([[Uidevice Currentdevice] Respondstoselector: @selector (setorientation:)]) {[[Uidevice Currentdevice] Performselector: @selector (setorientation:)   withobject: (ID) uiinterfaceorientationportrait];}} But-(BOOL) shouldautorotate {    return NO;} Be sure to return no

In addition, the project needs to be General Properties Deployment Info Portrait Front selected

2, can set the view and the battery bar direction to keep consistent


<span style= "FONT-SIZE:18PX;" >-(BOOL) Application: (UIApplication *) application didfinishlaunchingwithoptions: (nsdictionary *) launchOptions </span>

Add a sentence in this function

[[UIApplication sharedapplication] setstatusbarorientation:uideviceorientationportrait Animated:no];

The way to change the Android project to horizontal screen is to change the XML file:

in the set in androidmanifest.xml

android:screenorientation= "Portrait"

Cocos2dx how to set up iOS and Android horizontal screen vertical screen several ways

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.