Sometimes you don’t want to pin your UI components all the way to the outer edges. Sometimes you just want to set the height as a constraint instead of pinning to the bottom. Like in this UISearchBar

Screen Shot 2017-01-12 at 5.27.01 AM.png

Screen Shot 2017-01-12 at 5.27.12 AM.png

Instead of setting the bottom constraint. Set the height to be fixed at 44. This is better.

Another trick you can do when doing autolayout is to select the two elements you want to constrain, and control drag them between them in the side layout view display.

Screen Shot 2017-01-12 at 5.27.46 AM.png

Screen Shot 2017-01-12 at 5.29.37 AM.png

Advertisements