UIKit.NSLayoutConstraint Class
A relationship between two layout attributes used in a constraint-based layout.

See Also: NSLayoutConstraint Members


[Foundation.Register("NSLayoutConstraint", true)]
public class NSLayoutConstraint : Foundation.NSObject


An UIKit.NSLayoutConstraint specifies the relationship between two layout attributes (NSLayoutConstraint.FirstAttribute and NSLayoutConstraint.SecondAttribute, both of which are of type UIKit.NSLayoutAttribute) in a constraint-based layout.

The relationship consists of:

The constraint engine will set the value of the NSLayoutConstraint.FirstAttribute such that it satisfies the constraint FirstAttribute <Relation> <Constant> + <Multiplier> * <SecondAttribute>. For instance, in the following code from the "Media Notes" sample, tconstraint2 is a constraint that specifies that the top of the toolbar is going to be equal to the top of the View plus the value of the toolbarVerticalOffset, while tconstraint1 specifies that the width of the toolbar will be equal to the width of the View. Both of these constraints have a NSLayoutConstraint.Priority of 1.0.

C# Example

var tconstraint2 = NSLayoutConstraint.Create (

Related content


Namespace: UIKit
Assembly: Xamarin.iOS (in Xamarin.iOS.dll)
Assembly Versions: