首页 > 其他 > 详细

如何强制视频横竖屏

时间:2016-01-26 12:17:07      阅读:177      评论:0      收藏:0      [点我收藏+]

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就可以保证键盘也横屏啦

如何强制视频横竖屏

原文:http://www.cnblogs.com/yr434/p/5159807.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!