简体   繁体   中英

View controller in a tabbar is getting black while pushing another view controller in the navigation stack

I am having an application in which 4 view controllers are added to the tabbar.

The first view controller is landing page. The view controller is added in to the tab bar by following way.

SNZLandingViewController *landingViewController = [[UIStoryboard landingStoryboard] instantiateViewControllerWithIdentifier:SNZLandingIdentifier];

UINavigationController *landingNavigationController = [[UINavigationController alloc] initWithRootViewController:landingViewController];
[tabBarController addChildViewController:landingNavigationController];

Then from landing page when the user taps a button i am pushing a view controller

ProductsDetailsViewController *detailsPage = [[UIStoryboard storyboardWithName:@"ProductsDetailsViewController" bundle:nil] instantiateViewControllerWithIdentifier:@"ProductsDetailsViewIdentifier"];
[self.navigationController pushViewController:detailsPage animated:YES];

Now the details page appears. But on tapping "back" in details page, the landing page appears and is completely black.

One weird scenario that is happening is that, the landing page is black while navigation animation is taking place. Am i missing some thing here. any clue or suggestion is welcome.

So you don't want the navigation bar at the landing page at all?

Put this to your landing Page:

override func viewWillAppear(animated: Bool) {
    self.navigationController?.setNavigationBarHidden(true, animated: animated)
    super.viewWillAppear(animated)
}

and this to your followup viewcontroller:

override func viewWillAppear(animated: Bool) {
    self.navigationController?.setNavigationBarHidden(false, animated: animated)
    super.viewWillAppear(animated)
}

taken from here: iPhone hide Navigation Bar only on first page

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM