关于视频旋转shouldAutorotateToInterfaceOrientation,supportedInterfaceOrientations不调用问题

关于视频旋转shouldAutorotateToInterfaceOrientation,supportedInterfaceOrientations不调用问题

项目需求是某一个界面强制横竖屏,今天试了好多方法,看网上说的也没有解决我的问题,后来经过实验,成功解决,方法如下:

网上找了很多种说法,如下:
关于shouldAutorotateToInterfaceOrientation不执行问题

也有说是问题在info.plist里面的
在这里插入图片描述

但这并不能解决我的问题
我的项目里面是吧导航栏封装到父类里面了,所以父类里面给做了限制🚫
1,修改导航栏的父类
2,修改弹出方式

/**
 * 说明:播放器父类是UIView。
 屏幕锁屏方案需要用户根据实际情况,进行开发工作;
 如果viewcontroller在navigationcontroller中,需要添加子类重写navigationgController中的 以下方法,根据实际情况做判定 。
 */
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation{
    if (self.isLock) {
        return toInterfaceOrientation =


 UIInterfaceOrientationPortrait;
        
    }else{
        return YES;
    }
    return (toInterfaceOrientation == UIInterfaceOrientationPortrait);
}

- (BOOL)shouldAutorotate{
    
    return !self.isLock;
}

-(UIInterfaceOrientationMask)supportedInterfaceOrientations{

    if (self.isLock) {
    
        return UIInterfaceOrientationMaskLandscapeRight;
    }else{
        return UIInterfaceOrientationMaskPortrait|UIInterfaceOrientationMaskLandscapeLeft|UIInterfaceOrientationMaskLandscapeRight;
    }
}

 [self presentViewController:playVideoVC animated:YES completion:nil];

希望对你有帮助!

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值