如何强制视频横竖屏
2016-01-26 11:36
246 查看
1.9.0以下不需要设置工程支持横竖屏,9.0以上必须要设置支持LandscapeRight
2.maintabBar 里设置
- (BOOL)shouldAutorotate
{
return NO;
}
3.视频控制器里设置
- (BOOL)shouldAutorotate
{
return YES;
}
- (UIInterfaceOrientationMask)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscapeRight;
}
4.在方法里
旋转 window 但是也需要 application设置方向,两者要相反
UIApplication *application=[UIApplication sharedApplication];
[application setStatusBarOrientation:UIInterfaceOrientationLandscapeRight];
application.keyWindow.transform=CGAffineTransformMakeRotation(M_PI*2);
[[UIDevice currentDevice] setValue:[NSNumber numberWithInteger:UIDeviceOrientationLandscapeLeft] forKey:@"orientation"];
然后旋转view就可以保证键盘也横屏啦
2.maintabBar 里设置
- (BOOL)shouldAutorotate
{
return NO;
}
3.视频控制器里设置
- (BOOL)shouldAutorotate
{
return YES;
}
- (UIInterfaceOrientationMask)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscapeRight;
}
4.在方法里
旋转 window 但是也需要 application设置方向,两者要相反
UIApplication *application=[UIApplication sharedApplication];
[application setStatusBarOrientation:UIInterfaceOrientationLandscapeRight];
application.keyWindow.transform=CGAffineTransformMakeRotation(M_PI*2);
[[UIDevice currentDevice] setValue:[NSNumber numberWithInteger:UIDeviceOrientationLandscapeLeft] forKey:@"orientation"];
然后旋转view就可以保证键盘也横屏啦
相关文章推荐
- 网上图书商城项目学习笔记-008修改密码功能
- div+css将同一个div中图标和文字对齐
- SQL增加、删除、更改表中的字段名
- 那2000万的数据
- Python导入第三方模块后eclipse提示unresolved import
- VS版本记录、_MSC_VER记录
- 对spark中RDD的理解
- Terrier文档翻译:概述
- Android Navigation Drawer
- AndroidStudio开启时报错问题
- J2EE框架(Struts&Hibernate&Spring)的理解
- 3.1 活动应用样式与主题
- Quartz.NET笔记(八) SchedulerListeners
- 优化SQL查询:如何写出高性能SQL语句
- CodeForces 614B Gena's Code
- ConcurrentHashMap线程安全的实现
- Android layoutInflate.inflate 方法具体解释,removeView()错误解决
- ios 将时间戳转为时间类型
- 转:KVC 与 KVO 理解
- css相关 细节 优化 备忘