How to automatically resize UIImageView to image size in Interface Builder


It’s always frustrated me that when I create a UIImageView in Interface Builder I need to manually enter the size of view so that it matches the size of the image. I always go into Finder, open the image in Preview, find out the dimensions and type them into Interface Builder. Painful!

I learned a much better way today. Just drag in a UIImageView object into your .xib. Set the image in the Attributes Inspector. Then select the UIImageView and press Command =. Boom! The UIImageView is automagically resized to the size of the image!

This was the #1 thing that annoyed me about Interface Builder.

© Copyright Force Grind - Theme by Pexeto