UIView: preservesSuperviewLayoutMargins property
The preservesSuperviewLayoutMargins property determines whether the view uses its superview's layout margins when they are larger than its own.
Value
A boolean.
| Value | Effect |
|---|---|
true | Uses the superview's margins when they are larger than its own |
false | Uses only its own |
- Readable and writable.
- The default is
false. - The effect of setting it to
trueis not verified in the simulator. - Written values are converted with
Boolean():1, non-empty strings, and objects aretrue;0,'',null,undefined, andNaNarefalse. So writing'false'givestrue.
Examples
js
const child = new UIView();
child.preservesSuperviewLayoutMargins = true;
console.log(child.preservesSuperviewLayoutMargins);Result: Logs true.
Corresponding iOS API
UIView.preservesSuperviewLayoutMargins.