IOS Auto Layout scale down

I'm trying to create this view where images stick together and get resized when the device get smaller. Every thing works, but the only thing that I don't seem to get to work is the scale down.

As you can see from the screenshot there are two boxes that need to be centered. The space between the boxes always remains the same as do the width and height (e.g. 100x100 or 50x50 or 25x25 etc.). But it's this simple resize where the boxes get smaller that doesn't work. Do you guys have any clue what kind of auto layout property I should use? Or the combination of properties? Help is much appreciated.

Regards

Answers


I am absolutely agree with @rdelmar answer ... +1 for the answer...

Actually for a maintain ratio of any object you need to use aspect ratio like 100x100 in bigger screen and 50x50 in smaller screen...same for other view sizes...

and as we want both object to be same in terms of height and width, we have to give equal width and height of one object to another...

For a better understanding how it done ...here is the visual format..

And Here is the output as you want...


You can do this all in the storyboard. Give the views whatever spacing you want to the left and right edges, as well as a space between them. Select the 2 boxes, and choose "Equal Widths" and "Equal Heights". Choose one of the boxes, and give it a aspect ratio constraint of 1:1. Don't give the boxes any fixed width or height constraints.


Need Your Help

Computing complex math equations in python

python math numpy equation

Are there any libraries or techniques that simplify computing equations ?

C++ error handling pattern

c++ error-handling

We have a large code base with a lot of code which does this kind of thing: