If I create a button through Interface Builder
, then in the Size inspector
I can set the necessary bindings for the position and size of the button when turning. But what if the button is created programmatically in the code, and the interface builder
itself does not exist. How, in this case, can I set a binding to the lower left border of the screen?
|
2 answers
All descendants of UIView
have an autoresizingMask
property. To set multiple values to it, use +
.
updated: Better yet, use bitwise OR ( |
) instead of +
.
- Probably still not
+
, but|
(logical or). - VioLet - oneI did not mean logical OR, sorry, but bitwise . - VioLet
- Yes you are right. Apple advises using the bit "or." But nevertheless + for some reason also works ... But better still | use. - Tuggen
|
In the - (BOOL)shouldAutorotateToInterfaceOrientation:
(UIInterfaceOrientation)interfaceOrientation;
catch a message about changing the interface and set a new frame for it (the button), depending on the orientation of the device.
|