Open moerweng opened 1 year ago
代码中已经给UINavigationController重写了supportedInterfaceOrientations:
- (NSUInteger)supportedInterfaceOrientations { return [[self.viewControllers lastObject] supportedInterfaceOrientations]; }
所以你需要在最后一层Controller中锁定方向哦!
直接用demo跑的, 在iOS 10.1.1 和 iOS 16.1.2上测试, 16.1.2 调用demo中锁定方法, 源码中 navigationController category中重写的 -supportedInterfaceOrientations 等方法不会触发, 只有继承的UINavigationController的子类会触发.
你可以试试在不调试的情况下demo是否运行正常。
+1
我这没有iOS 16.1.2系统可供测试。。。。
iOS16.1.2 有UINavigationController的情况下, 锁定方向不起作用