-(void)landscapeAndPortraitChange{
UIInterfaceOrientation status = [[UIApplication sharedApplication]statusBarOrientation];
if (UIInterfaceOrientationIsPortrait(status)) {
[[UIDevice currentDevice] setValue:[NSNumber numberWithInteger:UIDeviceOrientationPortrait] forKey:@"orientation"];
[[UIDevice currentDevice] setValue:[NSNumber numberWithInteger:UIDeviceOrientationLandscapeLeft] forKey:@"orientation"];
} else{
[[UIDevice currentDevice] setValue:[NSNumber numberWithInteger:UIDeviceOrientationPortrait] forKey:@"orientation"];
}
}
强制横屏
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
推荐阅读更多精彩内容
- 最近有一个项目,例如:A界面跳转到B界面,A界面是竖屏的,B界面进入就要横屏。 花了半天的时间在网上搜索解决方案,...
- 1.appdelegate里 在appdelegate.h 加上 @property(nonatomic,assi...
- 最近在做一个React Native项目遇到一个需求:项目中有一个页面需要横屏显示(视频页面)其他页面都是竖屏显示...