TheLittleBoy / HXRotationTool

iOS 屏幕旋转工具类,兼容iOS 16,兼容Xcode 13和Xcode 14。
MIT License
26 stars 8 forks source link

iOS16.1.2 有UINavigationController的情况下, 锁定方向不起作用 #2

Open moerweng opened 1 year ago

moerweng commented 1 year ago

iOS16.1.2 有UINavigationController的情况下, 锁定方向不起作用

TheLittleBoy commented 1 year ago

代码中已经给UINavigationController重写了supportedInterfaceOrientations: - (NSUInteger)supportedInterfaceOrientations { return [[self.viewControllers lastObject] supportedInterfaceOrientations]; } 所以你需要在最后一层Controller中锁定方向哦!

moerweng commented 1 year ago

直接用demo跑的, 在iOS 10.1.1 和 iOS 16.1.2上测试, 16.1.2 调用demo中锁定方法, 源码中 navigationController category中重写的 -supportedInterfaceOrientations 等方法不会触发, 只有继承的UINavigationController的子类会触发.

TheLittleBoy commented 1 year ago

你可以试试在不调试的情况下demo是否运行正常。

JianfengJianfeng commented 5 months ago

+1

TheLittleBoy commented 5 months ago

我这没有iOS 16.1.2系统可供测试。。。。