title: UICollectionViewFlowLayout Size Warning When Rotating Device to Landscape
body: <p>We are using a UICollectionView to display cell that cover the full screen (minus the status and nav bar). The cell size is set from <code>self.collectionView.bounds.size</code>:</p>
  
  <pre><code>- (void)viewWillAppear:(BOOL)animated
  {
      //
      // value isn't correct with the top bars until here
      //
      CGSize tmpSize = self.collectionView.bounds.size;
      _currentCellSize = CGSizeMake( (tmpSize.width), (tmpSize.height));
  }
  
  - (CGSize)collectionView:(UICollectionView *)collectionView
                    layout:(UICollectionViewLayout*)collectionViewLayout
    sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
  
      return _currentCellSize;
  }
  </code></pre>
  
  <p>This sets the correct sizing for each device.  Each cell is defined to have no insets, and the layout has no header or footer.  However, when we rotate from portrait to landscape we get the following "complaint":</p>
  
  <pre><code>the behavior of the UICollectionViewFlowLayout is not defined because:
  the item height must be less that the height of the UICollectionView minus the section insets top and bottom values.
  </code></pre>
  
  <p>Now I understand this error, however we reset the size of the cell and use the flow layouts built in rotation transition:</p>
  
  <pre><code>-(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
  {
      //self.collectionView.bounds are still the last size...not the new size here
  }
  - (void)didRotateFromInterfaceOrientation: UIInterfaceOrientation)fromInterfaceOrientation
  {
      CGSize tmpSize = self.collectionView.bounds.size;
      _currentCellSize = CGSizeMake( (tmpSize.width), (tmpSize.height));
      [self.collectionView performBatchUpdates:nil completion:nil];//this will force the redraw/size of the cells.
  }
  </code></pre>
  
  <p>The cells render correctly in landscape.</p>
  
  <p>It seems as though the Flow Layout sees the old cell size (which causes the complaint since it will be too tall), but does read/render the new cell size set in <code>didRotateFromInterfaceOrientation</code>.</p>
  
  <p>Is there a way to get rid of the complaint?</p>
  
  <p>We've tried finding another hook during a device rotate transition that has access to the correct target screen size (vs the current screen size) with no luck.  Debug output shows the complaint happens after <code>willRotateToInterfaceOrientation</code> but before <code>didRotateFromInterfaceOrientation</code>.</p>
  
  <p>We've also verified the obvious; if we set up the cell height to be a fixed size less than the landscape screen height, the complaint doesn't occur.  Also, the complaint does not occur when rotating from landscape back to portrait.</p>
  
  <p>Everything runs fine, and renders correctly.  However this complaint worries us.  Anyone else have any ideas or solutions?</p>