Skip to content

NSLayoutYAxisAnchor: constraintLessThanOrEqualToSystemSpacingBelowAnchor() method ​

The constraintLessThanOrEqualToSystemSpacingBelowAnchor() method creates a constraint: this anchor is below other, and the distance between them is less than or equal to the system standard spacing multiplied by multiplier.

The standard spacing is a spacing defined by the system, not a specific number. The system decides its value, depending on what is at each end. The exact value is not verified in the simulator.

Syntax ​

constraintLessThanOrEqualToSystemSpacingBelowAnchor(other[, { multiplier }])

Parameters ​

other

Another NSLayoutYAxisAnchor.

options.multiplier

A number; a ratio with no unit. Optional; defaults to 1.

Return value ​

A new NSLayoutConstraint. It is not active yet; activate it with NSLayoutConstraint.activateConstraints() or isActive before it takes part in layout.

Exceptions ​

TypeError

  • other is a different kind of anchor, or not an anchor: same as constraintEqualToAnchor().
  • multiplier can't be converted to a finite number: multiplier must be a finite number, got "abc".

Examples ​

js
const parent = new UIView();
const a = new UIView();
const b = new UIView();
for (const v of [a, b]) {
  v.translatesAutoresizingMaskIntoConstraints = false;
  parent.addSubview(v);
}

const next = b.topAnchor.constraintLessThanOrEqualToSystemSpacingBelowAnchor(a.bottomAnchor);
next.isActive = true;

Effect: b sits below a, with at most the system standard spacing between them. Not verified in the simulator.

Corresponding iOS API ​

-[NSLayoutYAxisAnchor constraintLessThanOrEqualToSystemSpacingBelowAnchor:multiplier:]. In ObjC multiplier: is required; here it can be omitted.

See also ​