tabbar的push 和present方式

2018-08-25  本文已影响87人  guoguojianshu

遵守这个协议<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;

    }

}

上一篇 下一篇

猜你喜欢

热点阅读