A
A
artursk2015-09-16 17:27:12
iOS
artursk, 2015-09-16 17:27:12

How to set up a pop-up subview ( cub file ) on button click, for all iPhone sizes?

How to set up an autolayout for a xib file that appears on the main view, only at the click of a button, for all iPhone sizes? Or so that at least the same size pops up for all screens, but in the middle, of any of the screen sizes.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
ManWithBear, 2015-09-16
@ManWithBear

The same size in pixels or in relation to screen dimensions?
UPD. If the popup is in a separate file. Then it will not work to connect its dimensions with the dimensions of the parent view, because nothing is known about the existence of the parent at the time of layout.
Alternatively, you can have the view's init/new call initWithFrame: of a predetermined size.
UPD2. Found two interesting methods:

willMoveToSuperview:
didMoveToSuperview

In one of them it will be possible to adjust the required dimensions of the view. Or code to prescribe all the necessary constraints. The second option is preferable.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question