遵守这个协议<uitabbbarControlerDelegate>
-(BOOL)tabBarController:(UITabBarController*)tabBarController shouldSelectViewController:(UIViewController*)viewController{
DYUserInfoModel * user = [DYUserInfoModel getCurrentUser];
if(viewController ==self.viewControllers[1] || viewController ==self.viewControllers[2]) {
if([user.isBankCardisEqualToString:@"-1"]) {
DYBindingBankViewController *vc = [[UIStoryboard storyboardWithName:@"My" bundle:nil]instantiateViewControllerWithIdentifier:@"DYBindingBankViewController"];
//push
[(UINavigationController*)tabBarController.selectedViewController pushViewController:vc animated:YES];
//present
// [((UINavigationController *)viewController).childViewControllers[0] presentViewController:vc animated:YES completion:nil];
}
returnNO;
}else{
returnYES;
}
}
网友评论