首页 > 代码库 > navigationController显示隐藏问题

navigationController显示隐藏问题

今天遇到设置:

self.navigationController.navigationBarHidden= YES;

点击返回上一个UIViewController的时候这个时候这个navigationController也隐藏了

解决办法:

self.navigationController.delegate = self;

#pragma mark -UINavigationControllerDelegate

-(void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated

{

    if([viewController isKindOfClass:[self class]])

    {

        [navigationController setNavigationBarHidden:YES animated:animated];

    }

    else if([navigationController isNavigationBarHidden])

    {

        [navigationController setNavigationBarHidden:NO animated:animated];

    }

}

navigationController显示隐藏问题