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];

    }

}

posted @ 2016-11-02 16:48  与格律上  阅读(409)  评论(0编辑  收藏  举报