Search code examples
iosretina-displayautolayout

Constraint to add more space between two UIViews


I'm developing an iPhone application with XCode 4.5.2 and latest SDK.

Now I'm using Autolayout to work with one storyboard and use it with iPhone 4S and iPhone 5.

This is how can you see it with Retina 3.5 form factor:

enter image description here

And this is how you can see it with Retina 4 form factor:

enter image description here

I need to add more space between Todos los establecimientos and Todos los products. And also, between Todos los products and Por distancia >.

Todos los establecimientos and Todos los products now have a Top Space to: Superview constraint.

How can I do to add more space between those elements when I use Retina 4 form factor?


Solution

  • This can be done via a constraint with less than 1.0 Priority. To create a constraint between 2 views select both and click on the constraint button in the lower right corner of the interface builder to select the constraint you need in this case vertical spacing..

    Raywenderlich has a good tutorial on this: Part 1 Part 2

    Or read Apples documentation: Apple Guide - Understanding Constraints