1、UIViewController继承UITabbarcontroller
2、实现协议UITabBarControllerDelegate
3、设置协议
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
self.delegate = self;
}
4、实现协议方法
-(BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController{
if (/*满足一个条件时,不跳转,返回NO*/) {
return NO;
}
return YES;
}