title: Hiding/Showing UINavigationBar causes UICollectionView to change it's frames
body: <p>I have 2 UIViewControllers, both connected to the same UINavigationController. I want to hide the navigation bar for the first controller but show it for the second controller. For this behaviour I use this code:</p>
  
  <pre><code>override func viewWillAppear(animated: Bool) {
      self.navigationController?.setNavigationBarHidden(true, animated: false)
  }
  
  override func viewWillDisappear(animated: Bool) {
      self.navigationController?.setNavigationBarHidden(false, animated: false)
  }
  </code></pre>
  
  <p>This causes the second controller's UICollectionView to move down after around 0.5 second and the black area appears. The gray area is the collection view and its top constraint is linked to the view containing the UISegmentedControl.</p>
  
  <p>The message in the console :</p>
  
  <pre><code>the behavior of the UICollectionViewFlowLayout is not defined because:
  2016-03-15 17:26:58.829 Goku[56059:15539317] the item height must be less than the height of the UICollectionView minus the section insets top and bottom values, minus the content insets top and bottom values.
  2016-03-15 17:26:58.830 Goku[56059:15539317] The relevant     UICollectionViewFlowLayout instance is &lt;UICollectionViewFlowLayout:   0x7ffa28d49840&gt;, and it is attached to &lt;UICollectionView: 0x7ffa2a971000;   frame = (0 119; 375 548); clipsToBounds = YES; autoresize = RM+BM; gestureRecognizers = &lt;NSArray: 0x7ffa28d5f950&gt;; layer = &lt;CALayer: 0x7ffa28d6e120&gt;; contentOffset: {375, -64}; contentSize: {1125, 548}&gt;   collection view layout: &lt;UICollectionViewFlowLayout: 0x7ffa28d49840&gt;.
  2016-03-15 17:26:58.830 Goku[56059:15539317] Make a symbolic breakpoint at UICollectionViewFlowLayoutBreakForInvalidSizes to catch this in the debugger.
  </code></pre>
  
  <p>This message only appears if I hide/show the navigation bar, autolayout works just fine if I don't.</p>
  
  <p><a href="https://i.stack.imgur.com/qnSng.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qnSng.png" alt=""></a></p>
  
  <p>Setting the translucency property of the UINavigationBar to false fixes the problem for some reason, is there a way to fix this problem without changing the translucency property?</p>