视频播放想要全屏,使用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. 5 JInja2模版(适用于Django和Flask)

    模版 在生产环节下,我们要把后端程序(其实就是python)计算出来的数据和html页面结合起来做,这个时候模版就派上大用处了. Flask下的模版---Jinja2 Jinja是日本寺庙的意思,并且 ...

  2. jsp新建项目

    1.在原有项目的基础上新建一个文件夹 在文件夹内新建一个jsp文件 取名 JSP容器处理JSP文件需要以下三个阶段:翻译——编译——执行 JSP的页面元素包括 静态内容-HTML静态文本 指令-以“& ...

  3. 使用monkey技术修改python requests模块

    例如请求前和请求后各来一条日志,这样就不需要在自己的每个代码都去加日志了. 其实也可以直接记录'urllib3.connectionpool'  logger name的日志. 修改了requests ...

  4. Office2007打开文件提示“您尝试打开的文件xxx.xls的格式与文件扩展名指定的格式不一致”的解决办法

    添加如下注册表 Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Excel ...

  5. 九度 1494:Dota(完全背包)

    题目描述: 大家都知道在dota游戏中,装备是对于英雄来说十分重要的要素.英雄们不仅可以购买单个的装备,甚至某些特定的装备组合能够合成更强的装备.为了简化问题,我们将每个装备对于英雄的功能抽象为一个整 ...

  6. Go并发编程(四)

        并发基础   多进程  多线程 基于回调的非阻塞/异步IO     协程  协程  与传统的系统级线程和进程相比,协程的最大优势在于其“轻量级”,可以轻松创建上百万个而不会导致系统资源衰竭, ...

  7. [AX2012]关于财务默认维度

    和以前的版本一样,AX2012中很多地方都使用财务维度,比如客户.销售订单.销售订单行等,根据相应的财务维度设置,生成的相应财务分录将带有财务维度,方便后续对财务分录交易的分析.下图是在客户记录上设置 ...

  8. MyBatis入门程序之Mapper代理方式

    Mapper代理的开发方式,程序员只需要编写mapper接口(相当于dao接口)即可,MyBatis会自动为mapper接口生成动态代理实现类. 一.开发规范 1.mapper接口的全限定名要和map ...

  9. Windows 2012 R2 安装Nessus

    1.nessus官网注册 注册地址:https://www.tenable.com/products/nessus-home Name字段随意,邮箱需要填写自己的,方便接受注册码 2.注册后,登录邮箱 ...

  10. Qt生成ui文件对应的.h和.cpp文件

    在VS中,可以通过CMake设定QT5_WRAP_UI来编译a.ui到ui_a.h, 要想快速生成a.h和a.cpp,经过尝试,必须使用Qt Creator,否则就手写.