iOS tabbar禁止连续点击,或push过后,点击tabba
2018-05-22 本文已影响29人
风规自远
- (BOOL)tabBarController:(UITabBarController*)tabBarController shouldSelectViewController:(UIViewController*)viewController {
if([viewControllerisKindOfClass:[UINavigationControllerclass]]) {
UINavigationController* nav = (UINavigationController*)viewController;
// 当UINavigationController中viewControllers大于1或当前页面正在被选中时,当前页tabbar禁止再点击
if([nav.viewControllerscount] >1&& tabBarController.selectedViewController== viewController) {
returnNO;
}
}
return YES;
}