R
R
Reikyavik2014-07-10 18:56:10
Objective-C
Reikyavik, 2014-07-10 18:56:10

How to use Auto Layout to center a view vertically in its superview?

In general, the essence of the question is as follows:
There is a View (hereinafter the first), it contains another View (hereinafter the second). The dimensions of the second view are fixed (for example, a square), and the height of the first view is unknown (depends on the size of the content).
The task is as follows: how, using constraints, to make sure that the second view does not change its coordinates along the X axis, and the coordinate along the Y axis changes depending on the height value of the first view, i.e. so that the second view is centered vertically?
I hope I explained clearly.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
ManWithBear, 2014-07-11
@Reikyavik

As I understand it, you need something like this:
Image
// toaster won't accept my screenshots

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question