NSLayoutDimension: constraintGreaterThanOrEqualToConstant() method
The constraintGreaterThanOrEqualToConstant() method creates a constraint: this dimension is greater than or equal to a constant (this dimension ≥ value).
Syntax
constraintGreaterThanOrEqualToConstant(value)Parameters
value
A number, in pt. Converted with Number().
Return value
A new NSLayoutConstraint. It isn't active yet; it takes part in layout only after it's activated with NSLayoutConstraint.activateConstraints() or isActive. The constraint's secondAnchor is null, and its secondAttribute is 'notAnAttribute'.
Exceptions
TypeError
value can't be converted to a finite number: constant must be a finite number, got "abc".
Examples
js
const box = new UIView();
const c = box.widthAnchor.constraintGreaterThanOrEqualToConstant(100);
c.isActive = true;
console.log(c.relation, c.constant, c.secondAnchor);Result: box is at least 100 pt wide. The console prints greaterThanOrEqual 100 null.
Corresponding iOS API
-[NSLayoutDimension constraintGreaterThanOrEqualToConstant:].
See also
constraintEqualToConstant()constraintLessThanOrEqualToConstant()constraintGreaterThanOrEqualToAnchor(): comparing against another dimension