We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
iPhone
iPad
模拟器
iOS 10.x
8.x
1.x.x
当tab的item大于5,并且tab的selectedIndex大于等于5的时候,系统把子项强行放到了moreNavigationController,导致获取selectedViewController的navVC里面的viewControllers为0
(UIViewController *)qmui_visibleViewControllerIfExist {
if (self.presentedViewController) { return [self.presentedViewController qmui_visibleViewControllerIfExist]; }
if ([self isKindOfClass:[UINavigationController class]]) { return [((UINavigationController *)self).visibleViewController qmui_visibleViewControllerIfExist]; }
if ([self isKindOfClass:[UITabBarController class]]) { UITabBarController *tab = (UITabBarController *)self; if (tab.selectedIndex >= 4 && tab.customizableViewControllers.count > 5) { // 当tab的item大于5,并且tab的selectedIndex大于等于5的时候,系统把子项强行放到了moreNavigationController,导致获取selectedViewController的navVC里面的viewControllers为0 return [tab.moreNavigationController qmui_visibleViewControllerIfExist]; }else{ return [((UITabBarController *)self).selectedViewController qmui_visibleViewControllerIfExist]; } }
if ([self qmui_isViewLoadedAndVisible]) { return self; } else { QMUILog(@"UIViewController (QMUI)", @"qmui_visibleViewControllerIfExist:,找不到可见的viewController。self = %@, self.view = %@, self.view.window = %@", self, [self isViewLoaded] ? self.view : nil, [self isViewLoaded] ? self.view.window : nil); return nil; } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
运行环境
iPhone
/iPad
/模拟器
iOS 10.x
8.x
1.x.x
具体问题描述
当tab的item大于5,并且tab的selectedIndex大于等于5的时候,系统把子项强行放到了moreNavigationController,导致获取selectedViewController的navVC里面的viewControllers为0
(UIViewController *)qmui_visibleViewControllerIfExist {
if (self.presentedViewController) {
return [self.presentedViewController qmui_visibleViewControllerIfExist];
}
if ([self isKindOfClass:[UINavigationController class]]) {
return [((UINavigationController *)self).visibleViewController qmui_visibleViewControllerIfExist];
}
if ([self isKindOfClass:[UITabBarController class]]) {
UITabBarController *tab = (UITabBarController *)self;
if (tab.selectedIndex >= 4 && tab.customizableViewControllers.count > 5) {
// 当tab的item大于5,并且tab的selectedIndex大于等于5的时候,系统把子项强行放到了moreNavigationController,导致获取selectedViewController的navVC里面的viewControllers为0
return [tab.moreNavigationController qmui_visibleViewControllerIfExist];
}else{
return [((UITabBarController *)self).selectedViewController qmui_visibleViewControllerIfExist];
}
}
if ([self qmui_isViewLoadedAndVisible]) {
return self;
} else {
QMUILog(@"UIViewController (QMUI)", @"qmui_visibleViewControllerIfExist:,找不到可见的viewController。self = %@, self.view = %@, self.view.window = %@", self, [self isViewLoaded] ? self.view : nil, [self isViewLoaded] ? self.view.window : nil);
return nil;
}
}
问题截图
The text was updated successfully, but these errors were encountered: