0

This is my very first question to the helpful group of stackoverflow.com Please bear with me if question framing is cumbersome!!

I have a collectionView(in a ViewController),embedded in a NavigationViewController.

I have used didSelectItemAtIndexPath for each of the collectionView cells, linking them to different viewControllers,say VC1,VC2 etc I have hidden the Navigation bar, in the ViewController containing the collectionView, using the code

self.navigationController?.navigationBar.hidden = true

In each of VC1,Vc2....., I have tried to unhide the navigationBar using the code,

self.navigationController?.navigationBar.hidden = False

During simulation, using xCode, the navigation bar appears only in VC1, but not in VC2,VC3....

Genish Parvadia
  • 1,437
  • 3
  • 17
  • 30
Veena
  • 3
  • 3

1 Answers1

0

From the details you provided it is hard to guess what is exactly the issue.

The navigation controller will remember its status, as long as you use push segues, it should stay hidden, unless you set it to show again. You can set it to be hidden before you perform the transition, say in didSelectItemAtIndexPath.

To hide the navigation controller, you can use:

navigationController?.setNavigationBarHidden(true, animated: true)

and to show it

navigationController?.setNavigationBarHidden(false, animated: true)
Idan
  • 5,405
  • 7
  • 35
  • 52