title: On iOS11, how to have UIToolbar to size all items to fit?
body: <p>Up to iOS 10, an <code>UIToolbar</code> with flexible space bar buttom items between its items would automatically reduce the font so that all text get displayed on the screen. Sample below (iOS 10):</p>
  
  <p><a href="https://i.stack.imgur.com/ynlMP.png" rel="noreferrer"><img src="https://i.stack.imgur.com/ynlMP.png" alt="iOS 10 Sample"></a></p>
  
  <p>Ever since XCode 9, when running iOS 11 on simulator my toolbar is displayed like this:</p>
  
  <p><a href="https://i.stack.imgur.com/2caHx.png" rel="noreferrer"><img src="https://i.stack.imgur.com/2caHx.png" alt="iOS 11 Sample"></a></p>
  
  <p>Not only did the text not have its font size reduced but the last bar button item (which has no text, only an image) is gone.</p>
  
  <p>Trying to solve this, I've found out that since iOS 11, <code>UIToolbar</code> now  uses Autolayout instead of Frames. Some posts related in a way with this problem suggests creating constraints for the items, specifying width and/or height for items.</p>
  
  <p>However, what I want to achieve is fit everything in the toolbar, even if it means reducing the font size. I don't think I can go with setting fixed width/height programmatically then.</p>
  
  <p>Also, this was built using IB on a Storyboard. <code>UIBarButton</code> class doesn't give me access to the UILabel (for text items) or ImageView (for items with image). I've inspected and <code>customView</code> is <code>nil</code> at runtime.</p>
  
  <p>I tried creating the items via code, setting <code>customView</code> to an <code>UILabel</code> with <code>adjustsFontSizeToFitWidth</code> set to <code>true</code> without any luck. I have no clue what is the purpose of flexible space bar items on iOS 11.</p>
  
  <p>So, how to mimic the behavior I had before? Fit all items and resize text automatically?</p>