Using iOS 6 auto-layout to view position relative to supervisor size

I want objects located relative to the size of the supervisor, and not absolutely.

For example, I do not want to say that the element is "50px on top", I want to say that it is "1/3 of the way down."

Is there a way to do this using auto layout? If not, what is the best way?

Greetings

+4
source share
2 answers

Add an exit to the restriction of the height of the superstructure and the restriction of access to the upper space. In the code, set the top-level constraint constant to a value equal to 0.3 * the superstructure height constraint.

0
source

If you are using IB, just place the element you want in and set it to maintain its upper space until Superview. This will keep the element at such a distance from the top for both 4 and 3.5-inch devices.

-1
source

Source: https://habr.com/ru/post/1443414/


All Articles