IOS 点击tabbaritem跳转到一个新界面,且隐藏tabbar
2014-12-04 11:38
666 查看
先自定义一个UITabbarController,用于Storyboard中
再在MyTabbarController中实现protocol
则找到该tabbar,我的是父控件的tabbar,所以
点击以上图片中的“日记”时,则
再在MyTabbarController中实现protocol
@interface MyTabbarController : UITabBarController <UITabBarControllerDelegate> @end再实现代理里面的方法
@implementation MyTabbarController - (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController { NSLog(@"shouldSelectViewController %@", tabBarController.selectedViewController); if (viewController.tabBarItem.tag == 100) { DiaryViewController *vc = [self.storyboard instantiateViewControllerWithIdentifier:DIARY_VC_ID]; [((UINavigationController *)tabBarController.selectedViewController) pushViewController:vc animated:YES]; return NO; } return YES; } - (id)initWithCoder:(NSCoder *)aDecoder { self = [super initWithCoder:aDecoder]; if (self) { self.delegate = self; } return self; } @end在要监听的tabbaritem跳转的viewcontroller中(比如点击一个item隐藏tabbar,而且有返回按钮)
则找到该tabbar,我的是父控件的tabbar,所以
- (void)viewWillAppear:(BOOL)animated { self.parentViewController.tabBarController.tabBar.hidden = YES; }点击返回按钮后回到开始所选中的tabbaritem
- (void)viewWillDisappear:(BOOL)animated { self.parentViewController.tabBarController.tabBar.hidden = NO; }
点击以上图片中的“日记”时,则
相关文章推荐
- iOS tabbar和navigation组合,点击item两次,会pop到上一个页面,解决不让控制器跳转的方法
- iOS 点击一个页面上的按钮跳转到tabBar的另一个页面
- ios点击推送信息跳转Controller之后返回首页controller tabbar 不隐藏的bug
- ios开发:怎么实现点击一个按钮,跳转到一个新的界面,并回退到上一界面
- iOS跳转界面时隐藏tabBar的方法
- iOS使用UITabbarController跳转(push)界面,如何自动隐藏底部tabbar?
- iOS 开发之 点击tabbarItem添加是否跳转登录页面判断
- iOS 开发之 点击tabbarItem添加是否跳转登录页面判断
- 在ios中自定义tabbar跳转隐藏问题
- iOS实战演练之跳转界面时隐藏tabBar的方法
- iOS跳转延迟,跳转隐藏tabbar
- (iOS开发)点击tabbar中的按钮显示首页,再如何跳转页面
- iOS跳转界面时隐藏tabBar的方法
- iOS 隐藏tabbar会导致底部tabbar的位置的空间不能被点击响应
- ios点击隐藏tabBar 返回tabBar
- 自定义的tabbar在跳转之后隐藏tabbar后,tabbar原来的位置不能响应点击事件,这样解决
- iOS中跳转控制器隐藏底部tabBar
- iOS开发之解决隐藏tabbar后原位置无法响应点击事件的问题
- iOS巅峰之解决隐藏tabbar后原位置无法响应点击事件的问题
- iOS -- 点击button实现tabbar视图控制器跳转