关于强制横或竖屏的坑

关于全局或者指定页面的横或竖屏的方法及注意细节,在这里不再赘述,网上很多,大致就是

override var shouldAutorotate: Bool{

        return false

    }

    override var supportedInterfaceOrientations: UIInterfaceOrientationMask{

        if UIDevice.current.userInterfaceIdiom == UIUserInterfaceIdiom.phone {

            return UIInterfaceOrientationMask.portrait

        } else {

            return UIInterfaceOrientationMask.landscapeRight

        }

    }

    override var preferredInterfaceOrientationForPresentation: UIInterfaceOrientation{

        if UIDevice.current.userInterfaceIdiom == UIUserInterfaceIdiom.phone {

            return UIInterfaceOrientation.portrait

        } else {

            return UIInterfaceOrientation.landscapeRight

        }

    }

楼主之前遇到一个坑,真的是很不解,就是个demo,不知道怎么就弄出一个怪事。。。。一般我们的项目里只会有这个红圈里的配置


但是楼主的项目里,不知道怎么弄的,莫名其妙的出现了这个

这个东西直接导致了楼主上面那段代码对iPad毫无作用,甚至系统对这段代码完全不响应。。。楼主分析这个独特的配置应该是为了方便universal项目,但俩种设备的转向又不同的项目。。。总之这个独特又方便的配置,如果使用,那么上面那段代码就会失效

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值