iOS中强制app竖屏的解决办法

项目默认是横屏的,修改竖屏的方法是在ios/RootViewController.mm修改以下方法:
- (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;
}

android项目修改为横屏的方法是修改xml文件:
在AndroidManifest.xml中设置
android:screenOrientation="portrait"


你可能感兴趣的:(iOS中强制app竖屏的解决办法)