tabbar禁止连续点击,或push过后,禁止点击tabbar后返回
根视图下面加上
#pragma mark - UITabBarDelegate
- (BOOL)tabBarController:(UITabBarController*)tabBarController shouldSelectViewController:(UIViewController*)viewController {
if([viewController isKindOfClass:[UINavigationController class]]) {
UINavigationController* nav = (UINavigationController*)viewController;
// 当UINavigationController中viewControllers大于1或当前页面正在被选中时,当前页tabbar禁止再点击
if([nav.viewControllers count] >1 && tabBarController.selectedViewController == viewController) {
return NO;
}
}
return YES;
}