Cocos2dx: How to set up portrait screen for ios and Android, cocos2dxandroid
Cocos2d-x compiled to ios, the default is landscape, if you want to change to http: // portrait screen, different ios versions, the method will be different
On ios7, we may have configured a portrait screen, but it may change to ios6. BelowIn vainShare with you my practices
Reprinted please indicate the address http://blog.csdn.net/u010229677
1. General
In the RootViewController. mm file
- (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;}
---- You can also do this -----
If ([[UIDevice currentDevice] respondsToSelector: @ selector (setOrientation :)]) {[[UIDevice currentDevice] performSelector: @ selector (setOrientation :) withObject :( id) UIInterfaceOrientationPortrait];} // But-(BOOL) shouldAutorotate {return NO;} // no must be returned
In addition, You must select the project's General property Deployment Info Portrait.
2. You can set the view to be consistent with the battery entry direction.
In AooController. mm
<span style="font-size:18px;">- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions </span>
Add a sentence to this function.
[[UIApplication sharedApplication] setStatusBarOrientation:UIDeviceOrientationPortrait animated: NO];
To change the android project to a horizontal screen, modify the xml file:
Set in AndroidManifest. xml
Android: screenOrientation = "portrait"
Ios and android are both developed in the native language. Which one is faster than cocos2dx? Because cocos2dx has various problems.
Cocos2dx is used for game development. If it is used, it is certainly not possible to use the game engine. The game uses cocos2dx in a complex way, and the engine is not needed if it is not complex.
When the layout of the horizontal and vertical screens of android is different, do I need onCreate () to reload them?
Reload by default... you need to change