`
zheyiw
  • 浏览: 997183 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

UITabBarController 单击 再点击 双击

阅读更多

UITabBarController

//当选中项改变的时候会触发
- (void)tabBarController:(UITabBarController*)tabBarController didSelectViewController:(UIViewController*)viewController {
    NSLog(@"disSelect");
//使每次点击tab都回到跟目录
    //    if ([viewController isKindOfClass:[UINavigationController class]]) {
    //        [(UINavigationController*)viewController popToRootViewControllerAnimated:YES];
    //    }    
}


//每次点击当前tab的时候会触发
- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)vc {  
  NSLog(@"shouldSelect");
//当前选中的tab
    UIViewController *selectTab = tabBarController.selectedViewController;  
//vc:  将要选中的tab
//判断是不是选择了自己
  if ([selectTab isEqual:vc]) { }
}

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics