title: UIBarButton button image stretched width
body: <p><strong>Problem</strong></p>
  
  <p>After upgrading to XCode 9 and migrating my code to Swift 4, I've come across a few problems that I wasn't expecting. One of them is that the navigation bar in my app contains a button in the top left bar button item slot with an image, and now the image (and button) is stretched halfway across the screen for all view controllers (some have autolayout and some don't). Before XCode 9, it was working perfectly fine, and this problem only popped up after I updated XCode.</p>
  
  <p><strong>What I've tried</strong></p>
  
  <p>From <a href="https://stackoverflow.com/questions/7101608/setting-image-for-uibarbuttonitem-image-stretched">this old SO post</a> someone posted a recent answer that seems to suggest my problem stems from the different sizes for images in Assets.xcassets, but I don't understand why that would be a problem. I tried duplicating the image for the button and renaming it with "@2x" at the end (not sure what difference that makes...) and dragging it into the 2x slot in Assets.xcassets, and that somehow made the button slightly less stretched (about a third of the screen instead of about half). Overall, I'm just confused at why I have this problem, and would appreciate a solution that can fix my problem <strong>and</strong> explain why it worked before, but now doesn't.</p>
  
  <p>Thanks in advance.</p>