美文网首页
tabbar的push 和present方式

tabbar的push 和present方式

作者: guoguojianshu | 来源:发表于2018-08-25 14:24 被阅读87次

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

    }

}

相关文章

网友评论

      本文标题:tabbar的push 和present方式

      本文链接:https://www.haomeiwen.com/subject/vxhgiftx.html