Returns a constraint that defines the anchor’s size attribute as greater than or equal to the specified anchor multiplied by the constant.
SDKs
- iOS 9.0+
- macOS 10.11+
- Mac Catalyst 13.0+
- tvOS 9.0+
Frameworks
- UIKit
- App
Kit
Declaration
func constraint(greaterThanOrEqualTo anchor: NSLayout Dimension, multiplier m: CGFloat) -> NSLayout Constraint
Parameters
anchor
A dimension anchor from a
UIView
,NSView
, orUILayout
object.Guide m
The multiplier constant for the constraint.
Return Value
An NSLayout
object that defines the attribute represented by this layout anchor as greater than or equal to the attribute represented by the anchor
parameter multiplied by the m
constant.
Discussion
This method defines the relationship first attribute >= m * 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.
// Creating a constraint using NSLayoutConstraint
NSLayoutConstraint(item: saveButton,
attribute: .Width,
relatedBy: .GreaterThanOrEqual,
toItem: cancelButton,
attribute: .Width,
multiplier: 2.0,
constant: 0.0).active = true
// Creating the same constraint using constraintGreaterThanOrEqualToAnchor:multiplier:
saveButton.widthAnchor.constraintGreaterThanOrEqualToAnchor(cancelButton.widthAnchor, multiplier: 2.0).active = true