標籤:android style color os io strong ar for 檔案
IOS通用的
只需要在RootViewController.mm檔案裡面
1
- (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;}
2
if ([[UIDevice currentDevice] respondsToSelector:@selector(setOrientation:)]) {[[UIDevice currentDevice] performSelector:@selector(setOrientation:) withObject:(id)UIInterfaceOrientationPortrait];}}//但是- (BOOL) shouldAutorotate { return NO;}//一定要返回no
可以設定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檔案中,
screenOrientation="landscape" 為橫屏,
screenOrientation="portrait"為豎屏
cocos2dx如何設定ios和Android橫屏豎屏的幾種方法