美文网首页iOS开发程序员
iOS tabbar禁止连续点击,或push过后,点击tabba

iOS tabbar禁止连续点击,或push过后,点击tabba

作者: 风规自远 | 来源:发表于2018-05-22 11:28 被阅读29次

- (BOOL)tabBarController:(UITabBarController*)tabBarController shouldSelectViewController:(UIViewController*)viewController {

    if([viewControllerisKindOfClass:[UINavigationControllerclass]]) {

        UINavigationController* nav = (UINavigationController*)viewController;

         //  当UINavigationController中viewControllers大于1或当前页面正在被选中时,当前页tabbar禁止再点击

        if([nav.viewControllerscount] >1&& tabBarController.selectedViewController== viewController) {

             returnNO;

        }

     }

    return YES;

}

相关文章

网友评论

    本文标题:iOS tabbar禁止连续点击,或push过后,点击tabba

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