constraint(equalTo:)
Returns a constraint that defines one item’s attribute as equal to another.
Declaration
func constraint(equalTo anchor: NSLayoutAnchor<AnchorType>) -> NSLayoutConstraintParameters
- anchor:
A layout anchor from an Nsview or Nslayoutguide object. You must use a subclass of Nslayoutanchor that matches the current anchor. For example, if you call this method on an Nslayoutxaxisanchor object, this parameter must be another Nslayoutxaxisanchor.
Return Value
An NSLayoutConstraint object that defines an equal relationship between the attributes represented by the two layout anchors.
Discussion
This method defines the relationship first attribute = second attribute. Where first attribute is the layout attribute represented by the anchor receiving this method call, and second attribute is the layout attribute represented by the anchor parameter.
The constraints produced by the following two examples are identical.
See Also
Related Documentation
NSLayoutConstraint- Auto Layout Guide