How to center two middle squares with autolayout to preserve equal spaces between all of them?
Actually, i can outlet constraints and set it with computations involving container width and so on, but maybe there is some more smart way?
How to center two middle squares with autolayout to preserve equal spaces between all of them?
Actually, i can outlet constraints and set it with computations involving container width and so on, but maybe there is some more smart way?
My approach, with Interfacebuidler, is using "spacer views"
Spacer views are UIView that I have set to match widths equally.
.1. Black frames are UIViews
.2. UIImageView are squares
.3. Set equals width beetween spacer views
.4. Set equals width beetween squares
.4. Add edge constraints beetween spacer views and squares
.5. Set spacer view to transparent
If you need more detail to do that with Interface builder or by the code you should read this post :
Evenly space multiple views within a container view
Hope this can help you ;)