-1

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.

Divyang Desai
  • 7,483
  • 13
  • 50
  • 76

1 Answers1

0

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

Community
  • 1
  • 1
gasparuff
  • 2,295
  • 29
  • 48
  • i have already has this implementation in my code. but still its not working. is there any chance that autolayout constraints can lead to this? – Karthick Ramesh Oct 12 '16 at 22:20
  • Also the details that is appearing doesnt have nav bar initially. Then if i switch tab and come back the nav bar appears in the details page. – Karthick Ramesh Oct 12 '16 at 22:27
  • And also in the landing page i have a scroll view to which content view is added. – Karthick Ramesh Oct 12 '16 at 23:03
  • And also in the landing page i have a scroll view to which content view is added. Then have added 4 view controllers as subview. Will this create a problem with architecture wise? Also is is better to have the items as tableview cells to over come this issue? – Karthick Ramesh Oct 12 '16 at 23:05