iOS在某特定界面强制横屏
2016-04-13 00:00
489 查看
摘要: 项目是不支持横屏的,但在某个界面需要横屏
1、先上代码:
再次运行,完全旋转!
PS: 此种方法只针对present过来的界面有效,而对于push过来的是无效的。
2、获取设备的屏幕方向:
1、先上代码:
- (UIInterfaceOrientationMask)supportedInterfaceOrientations{ return UIInterfaceOrientationMaskAll; } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation{ return NO; } - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation{ return UIInterfaceOrientationLandscapeRight; }
再次运行,完全旋转!
PS: 此种方法只针对present过来的界面有效,而对于push过来的是无效的。
2、获取设备的屏幕方向:
if (![UIDevice currentDevice].generatesDeviceOrientationNotifications) { [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications]; } NSLog(@"%d",[UIDevice currentDevice].orientation); [[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications];
相关文章推荐
- iOS开发中控制屏幕旋转的编写方法小结
- 总结iOS App开发中控制屏幕旋转的几种方式
- iOS屏幕旋转学习笔记
- iOS屏幕旋转的bug
- iOS屏幕旋转之为横屏视频播放增加竖屏模式
- iOS强制横屏
- - (NSUInteger)supportedInterfaceOrientations 屏幕旋转方向选择
- android屏幕旋转时,禁止重新加载(onCreate)
- Swift监听屏幕旋转
- 界面横竖屏的一些问题总结
- android屏幕旋转时,Activity不重新调用onCreate的方法
- 随手笔记 强制横屏
- 视图旋转 AVPlayer视频播放视图旋转
- Android 旋转屏幕时禁止Activity重建
- linux嵌入式qt的屏幕旋转与字体大小
- Android 屏幕旋转问题
- iOS屏幕旋转学习笔记
- Android屏幕旋转设置
- Android旋转屏幕时阻止activity重建
- ios屏幕旋转