rickytan / RTRootNavigationController

Implicitly make every view controller has its own navigation bar
MIT License
2.15k stars 379 forks source link

iOS 16 使用UIWindowSceneGeometryPreferencesIOS切换横竖屏无效 #307

Closed mlcldh closed 2 years ago

mlcldh commented 2 years ago
// 切换横竖屏无效,并且errorHandler也不会回调错误
[viewController setNeedsUpdateOfSupportedInterfaceOrientations];
        UIWindowSceneGeometryPreferencesIOS *geometryPreferences = [[UIWindowSceneGeometryPreferencesIOS alloc] init];
        geometryPreferences.interfaceOrientations = interfaceOrientations;
        [windowScene requestGeometryUpdateWithPreferences:geometryPreferences errorHandler:^(NSError * _Nonnull error) {
            NSLog(@"errorHandler error %@", error);
            if (errorHandler) {
                errorHandler(error);
            }
        }];
rickytan commented 2 years ago

你的主工程有开启旋转支持吗?我的 demo 测试没问题,虽然回调也没有,但是旋转是生效的

image
rickytan commented 2 years ago

关闭设置后,回调有调。

Error Domain=UISceneErrorDomain Code=101 "None of the requested orientations are supported by the view controller. Requested: landscapeLeft; Supported: portrait" UserInfo={NSLocalizedDescription=None of the requested orientations are supported by the view controller. Requested: landscapeLeft; Supported: portrait}
mlcldh commented 2 years ago

你的主工程有开启旋转支持吗?我的 demo 测试没问题,虽然回调也没有,但是旋转是生效的 image

打开这个的话,横屏启动App是有问题的。

mlcldh commented 2 years ago

@rickytan 我试了下,切换横竖屏无效是我调用的问题,和RTRootNavigationController没关系,不好意思。

mlcldh commented 2 years ago

此问题非bug。