在建立的IOS項目,在項目的ios檔案夾下的RootViewController.mm檔案中修改如下代碼:
【1】
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return UIInterfaceOrientationIsLandscape( interfaceOrientation );}
改為
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {// return UIInterfaceOrientationIsLandscape( interfaceOrientation ); return UIInterfaceOrientationIsPortrait( interfaceOrientation );}
【2】
- (NSUInteger) supportedInterfaceOrientations{#ifdef __IPHONE_6_0 return UIInterfaceOrientationMaskLandscape;#endif}
改為
- (NSUInteger) supportedInterfaceOrientations{#ifdef __IPHONE_6_0// return UIInterfaceOrientationMaskLandscape; return UIInterfaceOrientationMaskPortrait;#endif}
【3】
- (BOOL) shouldAutorotate { return YES;}
改為
- (BOOL) shouldAutorotate {// return YES; return NO;}
【引用註明】http://bbs.csdn.net/topics/390386931
此帖中有如下補充:
//Android
//在onCreate裡添加
//鎖定豎屏
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);