-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
旋转控制没有效果 #715
Labels
Comments
这是 4.0.0-beta 的 bug,新版本将会修复,在此之前可以按照下文替换正确的代码: QMUITabBarViewController.m: - (BOOL)shouldAutorotate {
return self.presentedViewController ? [self.presentedViewController shouldAutorotate] : ([self.selectedViewController qmui_hasOverrideUIKitMethod:_cmd] ? [self.selectedViewController shouldAutorotate] : YES);
}
- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
// fix UIAlertController:supportedInterfaceOrientations was invoked recursively!
// crash in iOS 9 and show log in iOS 10 and later
// https://github.com/Tencent/QMUI_iOS/issues/502
// https://github.com/Tencent/QMUI_iOS/issues/632
UIViewController *visibleViewController = self.presentedViewController;
if (!visibleViewController || visibleViewController.isBeingDismissed || [visibleViewController isKindOfClass:UIAlertController.class]) {
visibleViewController = self.selectedViewController;
}
if ([visibleViewController isKindOfClass:NSClassFromString(@"AVFullScreenViewController")]) {
return visibleViewController.supportedInterfaceOrientations;
}
return [visibleViewController qmui_hasOverrideUIKitMethod:_cmd] ? [visibleViewController supportedInterfaceOrientations] : SupportedOrientationMask;
} QMUINavigationController.m: - (BOOL)shouldAutorotate {
return [self.visibleViewController qmui_hasOverrideUIKitMethod:_cmd] ? [self.visibleViewController shouldAutorotate] : YES;
}
- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
// fix UIAlertController:supportedInterfaceOrientations was invoked recursively!
// crash in iOS 9 and show log in iOS 10 and later
// https://github.com/Tencent/QMUI_iOS/issues/502
// https://github.com/Tencent/QMUI_iOS/issues/632
UIViewController *visibleViewController = self.visibleViewController;
if (!visibleViewController || visibleViewController.isBeingDismissed || [visibleViewController isKindOfClass:UIAlertController.class]) {
visibleViewController = self.topViewController;
}
return [visibleViewController qmui_hasOverrideUIKitMethod:_cmd] ? [visibleViewController supportedInterfaceOrientations] : SupportedOrientationMask;
} |
已发布 4.0.0 版本修复该问题。 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bug 表现
安装 QMUI 4.0.0-beta 后旋转出了问题。
QMUI-3.2.1版本我设置了BaseViewController->UIInterfaceOrientationMaskPortrait,某些页面支持UIInterfaceOrientationMaskAll,在3.2.1表现很好,4.0.0-beta版本后出现没有作用的情况。
猜测原因
4.0.0 版本 QMUITabBarViewController 通过supportedInterfaceOrientations设置可用的旋转方向,shouldAutorotate控制当前旋转方向。
3.2.1 版本 QMUITabBarViewController 通过supportedInterfaceOrientations控制旋转方向。
将 QMUITabBarViewController下的 supportedInterfaceOrientations 替换回 3.2.1版本的 supportedInterfaceOrientations写法不会出现该问题。
其他信息
The text was updated successfully, but these errors were encountered: