Reputation: 2437
Using iOS9's adaptive layout I would like to display 4 images in a row [x x x x], with all four images equally spaced and all four centered on screen.
I am using Xcode's Interface Builder to add constrains. I have added constrains to get an equal horizontal spacing of 15points between each image, but I want all 4 images to centre within in the frame regardless of screen size or orientation.
e.g. Current View
[x x x x ]
What I would like
[ x x x x ]
Any ideas?
Upvotes: 2
Views: 79
Reputation: 11
Insert a transparent (Clear) UIView object between images 2 and 3. Make it's width 15points, with no horizontal space between it and the images. Then centre this object.
Upvotes: 0
Reputation: 535557
Use the wonderful new UIStackView and center that. It contains your other views and you'll configure it to distribute them horizontally within itself as desired.
Upvotes: 3