//
//  SLBaseNavigationController.m
//  SLAiELTS
//
//  Created by Gusont on 2023/2/27.
//

#import "SLBaseNavigationController.h"

@interface SLBaseNavigationController ()<UINavigationControllerDelegate>

@end

@implementation SLBaseNavigationController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.delegate = self;
}

- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated
{
    [super pushViewController:viewController animated:animated];
    if (viewController.navigationItem.leftBarButtonItem == nil && [self.viewControllers count] > 1) {
//        [self resetDefaultBackBarItem:viewController];
    }
    
}

- (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated{
    BOOL isTabVC = navigationController.viewControllers.firstObject == viewController;
    if (isTabVC) {
        viewController.tabBarController.tabBar.hidden = NO;
    }
}

- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
{
    BOOL isTabVC = navigationController.viewControllers.firstObject == viewController;
    if (isTabVC) {
        [navigationController setNavigationBarHidden:YES animated:YES];
    }else {
        viewController.tabBarController.tabBar.hidden = YES;
    }
}

@end
