首页 > 代码库 > tabbar隐藏 重写navigation
tabbar隐藏 重写navigation
//
// ZFNavigationController.m
// Cartext
//
// Created by 谢泽锋 on 16/3/20.
// Copyright ? 2016年 xiezefeng. All rights reserved.
//
#import "ZFNavigationController.h"
@interface ZFNavigationController ()
@end
@implementation ZFNavigationController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
}
//-(void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated{
// if (self.viewControllers.count > 0) {
// viewController.hidesBottomBarWhenPushed = YES;
// }
// [super pushViewController:viewController animated:YES];
//}
-(UIViewController *)popViewControllerAnimated:(BOOL)animated
{
if (self.viewControllers.count > 0) {
self.tabBarController.tabBar.hidden=YES;
}else{
self.tabBarController.tabBar.hidden=NO;
}
return [super popViewControllerAnimated:animated];
}
- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated
{
// 第一个 控制器 不需要隐藏tabbar
if (self.viewControllers.count > 0) {
viewController.hidesBottomBarWhenPushed = YES;
self.tabBarController.tabBar.hidden=YES;
}else{
self.tabBarController.tabBar.hidden=NO;
}
[super pushViewController:viewController animated:animated];
}
- (NSArray *)popToViewController:(UIViewController *)viewController animated:(BOOL)animated
{
// 第一个 控制器 不需要隐藏tabbar
if (self.viewControllers.count > 2) {
[self.tabBarController.tabBar setHidden:YES];
} else {
[self.tabBarController.tabBar setHidden:NO];
}
return [super popToViewController:viewController animated:animated];
}
- (NSArray *)popToRootViewControllerAnimated:(BOOL)animated
{
[self.tabBarController.tabBar setHidden:NO];
return [super popToRootViewControllerAnimated:animated];
}
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
if (self.viewControllers.count > 1) {
[self.tabBarController.tabBar setHidden:YES];
} else {
[self.tabBarController.tabBar setHidden:NO];
}
}
@end
tabbar隐藏 重写navigation