Search code examples
iosuinavigationcontrolleruinavigationbarviewwillappear

iOS - NavigationBar hide/show


I have a master viewController and many detail viewController. Master viewController doesn't have any UINavigationBar but detail viewController has UINavigationBar. So I have some problem. When I swipe from detailVC to masterVC UINavigationBar hiding in detailVC

Have you any solution this?

I use these methods (master viewController )

 -(void)viewWillAppear:(BOOL)animated{

     [super viewWillAppear:animated];
     [self.navigationController setNavigationBarHidden:YES animated:YES];

    }

(detail viewController)

-(void)viewWillAppear:(BOOL)animated{
     [super viewWillAppear:animated];
    [self.navigationController setNavigationBarHidden:NO animated:YES];
}

enter image description here


Solution

  • Finally

    I have solved this issue.

    I wrote UINavigationBar hiding code for firstVC in the viewDidAppear method.

    -(void)viewDidAppear:(BOOL)animated{

     [super viewDidAppear:animated];
     [self.navigationController setNavigationBarHidden:YES animated:YES];
    

    }

    enter image description here