Matt Butler
Matt Butler

Reputation: 476

Side-by-side constraints on Xcode storyboard

enter image description here

I am wanting to make it so that each of these images are displayed as such in my application. There are 5 images in total each labeled above. I have tried multiple constraints and the use of views, but I cannot get a solution to work. This unit as a whole is to be centered both vertically and horizontally on the screen. Also, I would like this to be done without code and only with constraints inside of the Xcode IDE.

Upvotes: 0

Views: 114

Answers (1)

matt
matt

Reputation: 536027

First, position and size just the black cross image.

Now set the width and height constraints for all four images.

Finally, position each image. The first image is pinned to the top and left of the black cross image, the second is pinned to the top and right of the black cross image, and so on.

The following are just example values; it might make a little more sense to set the image height/width as a percentage of the black cross height/width, for example, and it's possible you might want to tweak the offset (constant) values:

enter image description here

Upvotes: 1

Related Questions