Cocos2d-x compiled to iOS, the default is horizontal screen, to change to HTTP//vertical screen, different versions of iOS, the method will also be different
On the iOS7 maybe we set the screen, but it may change on the IOS6. Let me give you a little bit of my practice.
Reprint Please specify address http://blog.csdn.net/u010229677
1, the General
only need to be in rootviewcontroller.mm file Inside
-(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. You can set the view and the battery bar direction to keep consistent
In the AOOCONTROLLER.MM
<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 modify an Android project to a horizontal screen is to modify the XML file:
in the set in androidmanifest.xml
android:screenorientation= "Portrait"