视频播放想要全屏,使用shouldAutorotate方法禁止主界面,tabbar控制器横屏,导致push进入播放页面不能横屏的问题。。。

- (BOOL)shouldAutorotate {

    return NO;

}

- (UIInterfaceOrientationMask)supportedInterfaceOrientations {

    return UIInterfaceOrientationMaskAll;

}

后面解决方法:

- (void)fullScreenClick:(UIButton *)sender {

    sender.selected = !sender.selected;

    if (sender.isSelected) {

        _backButton.hidden = YES;

        [self forceOrientationLandscapeLeft];

    } else {

        _backButton.hidden = NO;

        [self forceOrientationPortrait];

    }

}

//MARK: -- 强制横屏

- (void)forceOrientationLandscapeLeft

{

    AppDelegate *appdelegate=(AppDelegate *)[UIApplication sharedApplication].delegate;

    appdelegate.isForcePortrait=NO;

    appdelegate.isForceLandscape=YES;

    [appdelegate application:[UIApplication sharedApplication] supportedInterfaceOrientationsForWindow:self.view.window];

    YNCNavigationViewController *navi = (YNCNavigationViewController *)self.navigationController;

    navi.interfaceOrientation = UIInterfaceOrientationMaskLandscape;

    navi.interfaceOrientationMask = UIInterfaceOrientationMaskLandscape;

    //设置屏幕的转向为横屏

    [[UIDevice currentDevice] setValue:@(UIDeviceOrientationLandscapeLeft) forKey:@"orientation"];

    //刷新

    [UIViewController attemptRotationToDeviceOrientation];

}

//MARK: -- 强制竖屏

- (void)forceOrientationPortrait

{

    AppDelegate *appdelegate=(AppDelegate *)[UIApplication sharedApplication].delegate;

    appdelegate.isForcePortrait=YES;

    appdelegate.isForceLandscape=NO;

    [appdelegate application:[UIApplication sharedApplication] supportedInterfaceOrientationsForWindow:self.view.window];

    YNCNavigationViewController *navi = (YNCNavigationViewController *)self.navigationController;

    navi.interfaceOrientation = UIInterfaceOrientationPortrait;

    navi.interfaceOrientationMask = UIInterfaceOrientationMaskPortrait;

    //设置屏幕的转向为竖屏

    [[UIDevice currentDevice] setValue:@(UIDeviceOrientationPortrait) forKey:@"orientation"];

    //刷新

    [UIViewController attemptRotationToDeviceOrientation];

}

#import <UIKit/UIKit.h>

@interface AppDelegate : UIResponder <UIApplicationDelegate>

@property (strong, nonatomic) UIWindow *window;

@property (assign , nonatomic) BOOL isForceLandscape;

@property (assign , nonatomic) BOOL isForcePortrait;

@end

AppDelegate.m

-(UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window{

    if (self.isForceLandscape) {

        return UIInterfaceOrientationMaskLandscape;

    }else if (self.isForcePortrait){

        return UIInterfaceOrientationMaskPortrait;

    }

    return UIInterfaceOrientationMaskPortrait;

}

@interface YNCNavigationViewController : UINavigationController

//旋转方向 默认竖屏

@property (nonatomic , assign) UIInterfaceOrientation interfaceOrientation;

@property (nonatomic , assign) UIInterfaceOrientationMask interfaceOrientationMask;

@end

.m

#pragma mark - 由子控制器控制自己的转屏逻辑

- (BOOL)shouldAutorotate {

    return YES;

}

- (UIInterfaceOrientationMask)supportedInterfaceOrientations {

    return self.interfaceOrientationMask;

}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {

    return self.interfaceOrientation;

}

iOS - 视频播放处理全屏/横屏时候遇见的坑的更多相关文章

  1. H5视频播放自动全屏,暂停退出全屏等功能

    html5视频播放自动全屏,暂停退出全屏等功能 在参考了html5 video fullScreen全屏实现方式及司徒正美的书<javascript框架设计>287页相关代码后,在Safa ...

  2. JS 取消iOS播放自动全屏:

    iOS下浏览器模式下h5播放器强制是全屏的,除非在app下才可以非全屏播放,需要两个配置: (1)播放器添加参数: playsinline:true(我使用的是阿里云的播放器,其他的需要自己找找是那个 ...

  3. iOS任何界面全屏炫酷倒计时,一句代码就够了

    概述 iOS全屏炫酷倒计时,任何界面只需要调用一句代码就能实现,支持定制倒计时数字.倒计时结束时显示的文本.支持倒计时播放图片.开始倒计时和结束倒计时的block和delegate回调.支持定制文本颜 ...

  4. C# 后台按键 视频播放器 全屏后无法 触发

    第一种  (全屏不可触发) protected override bool ProcessCmdKey(ref System.Windows.Forms.Message msg, System.Win ...

  5. HTML5新标签video在iOS上默认全屏播放

    今天做一个app时发现一个问题,应用html5中的video标签加载视频,在Android手机上默认播放大小,但是换成iPhone手机上出问题了,默认弹出全屏播放,查找了好多论坛,都没有谈论这个的.然 ...

  6. ios滑动手势全屏(这段代码实现了下一级控制器滑到上一级控制器)

    在自定义导航控制器里面加以下代码就增加全屏滑动手势 >推向前一个控制器 //  HBNavigationController.m // #import "HBNavigationCon ...

  7. html-----vedio标签(HTML5新标签VIDEO在IOS上默认全屏播放)

    今天做一个app时发现一个问题,应用html5中的video标签加载视频,在Android手机上默认播放大小,但是换成iPhone手机上出问题了,默认弹出全屏播放,查找了好多论坛,都没有谈论这个的.然 ...

  8. video 安卓ios系统 浏览器 全屏播放以及自动播放的问题

    ios自动播放 <body onload="load()"> <div class="result_box"> <div clas ...

  9. Android:webView加载h5网页视频,播放不了,以及横屏全屏的问题和实现自定义加载进度条的效果

    1.webView加载h5网页视频,播放不了,android3.0之后要在menifest添加硬件加速的属性 android:hardwareAccelerated="true". ...

随机推荐

  1. zabbix监控系列(5)之通过trap模式监控网络设备

  2. Android:AS与Unity3D之间打包的各种坑及解决方案

    作者:DrkCore (http://blog.csdn.net/DrkCore) 原文链接:(http://blog.csdn.net/drkcore/article/details/5207937 ...

  3. Android开发学习笔记-md5加密算法

    十六位的md5加密 private static void Md5(String plainText ) { try { MessageDigest md = MessageDigest.getIns ...

  4. Python 多线程相关知识学习

    多线程类似于同时执行多个不同程序,多线程运行有如下优点: 使用线程可以把占据长时间的程序中的任务放到后台去处理. 用户界面可以更加吸引人,这样比如用户点击了一个按钮去触发某些事件的处理,可以弹出一个进 ...

  5. teamviwer安装提示 Verification of your Teamviewer version failed!.

    打开cmd输入 regsvr32 c:\windows\SysWOW64\wintrust.dll 就可以了.

  6. SPOJ QTREE5 lct

    题目链接 对于每一个节点,记录这个节点所在链的信息: ls:(链的上端点)距离链内部近期的白点距离 rs:(链的下端点)距离链内部近期的白点距离 注意以上都是实边 虚边的信息用一个set维护. set ...

  7. 大杂烩 -- Iterator 和 Iterable 区别和联系

    基础大杂烩 -- 目录 用Iterator模式实现遍历集合  Iterator模式是用于遍历集合类的标准访问方法.它可以把访问逻辑从不同类型的集合类中抽象出来,从而避免向客户端暴露集合的内部结构. 例 ...

  8. 把mongodb服务添加到系统服务中,报错:[sc] openscmanager 失败 5

    添加mongodb系统服务命令如下: sc create MongoDB binPath= "D:\MongoDB\bin\mongod.exe --service --dbpath D:\ ...

  9. Python easyGUI 登录框 非空验证

    import easygui as g msg='欢迎注册' title='注册' fieldNames=['*用户名','*密码','*重复密码','真实姓名','手机号','QQ','e-mail ...

  10. springJdbc in 查询,Spring namedParameterJdbcTemplate in查询

    springJdbc in 查询,Spring namedParameterJdbcTemplate in查询, SpringJdbc命名参数in查询,namedParameterJdbcTempla ...