in interface builder, can see view's "margin" mentioned.
yet, in code, 1 can use layout anchors , also, view has "layoutmarginsguide".
why anchors appear in code?
layout anchors not actual participants in auto layout, convenience entities exists provide nicer way programmatically create constraints. apple docs:
the nslayoutanchor class factory class creating nslayoutconstraint objects using fluent api
since interface builder provides own convenience mechanisms generating constraints, there no need use layout anchor metaphor. keep in mind outputs layout anchors same constraints created using other mechanisms (including interface builder), it's best consider layout margins guide , layout anchors hows , not whats. interface builder different how achieve same what anchors.
Comments
Post a Comment