UILayoutGuide: owningView property
The owningView property is the view this layout guide has been added to.
Value
A UIView, or null.
- Read-only. Assigning to it throws
TypeError. nullbefore it is added to a view. This case is not verified in the simulator.- After it is added with the view's
addLayoutGuide(), it is that view; after it is removed withremoveLayoutGuide(), it goes back tonull. Going back tonullafter removal is not verified in the simulator. - For layout guides the system provides (such as
safeAreaLayoutGuide),owningViewis the view that provides it. Not verified in the simulator. - No change notification. Only the App's own code changes it.
Examples
js
const card = new UIView();
const guide = new UILayoutGuide();
card.addLayoutGuide(guide);
console.log(guide.owningView === card);Result: logs true.
Corresponding iOS API
UILayoutGuide.owningView.
See also
layoutFrame: expressed in its coordinate system