See Also: NSLayoutConstraint
[MonoTouch.ObjCRuntime.Introduced(MonoTouch.ObjCRuntime.PlatformName.iOS, 6, 0, MonoTouch.ObjCRuntime.PlatformArchitecture.None, null)]
[MonoTouch.ObjCRuntime.Unavailable(MonoTouch.ObjCRuntime.PlatformName.WatchOS, MonoTouch.ObjCRuntime.PlatformArchitecture.All, null)]
public class NSLayoutConstraint : NSObject
An NSLayoutConstraint specifies the relationship between two layout attributes (NSLayoutConstraint.FirstAttribute and NSLayoutConstraint.SecondAttribute, both of which are of type NSLayoutAttribute) in a constraint-based layout.
The relationship consists of:
- A NSLayoutRelation (e.g., NSLayoutRelation.GreaterThanOrEqual)
- A floating point NSLayoutConstraint.Multiplier
- A single-precision floating point NSLayoutConstraint.Constant
- A floating point NSLayoutConstraint.Priority. Constraints with higher priorities are satisfied before constraints with lower priorities.
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.
var tconstraint2 = NSLayoutConstraint.Create (toolbar, NSLayoutAttribute.Top, NSLayoutRelation.Equal, View, NSLayoutAttribute.Top, 1.0f, toolbarVerticalOffset); toolbarTopConstraint = tconstraint2; var tconstraint1 = NSLayoutConstraint.Create (toolbar, NSLayoutAttribute.Width, NSLayoutRelation.Equal, View, NSLayoutAttribute.Width, 1.0f, 0.0f);
Assembly: monotouch (in monotouch.dll)
Assembly Versions: 0.0.0.0
The members of MonoTouch.UIKit.NSLayoutConstraint are listed below.
See Also: NSObject
|Default constructor, initializes a new instance of this class.|
|A constructor that initializes the object from the data stored in the unarchiver object.|
|Constructor to call on derived classes to skip initialization and merely allocate the object.|
|A constructor used when creating managed representations of unmanaged objects; Called by the runtime.|
|Active||Boolean. Controls whether the constraint is active. Active constraints are used as part of the auto-layout process, those that are not are ignored.|
|ClassHandle||IntPtr. The handle for this class.|
|Constant||Single. Indicates the constant float applied to the constraint.|
|[read-only]||FirstAttribute||NSLayoutAttribute. The attribute of the first item participating in the constraint.|
|[read-only]||FirstItem||NSObject. The first item participating in the constraint.|
|[read-only]||Multiplier||Single. Applied to the second attribute participating in the constraint.|
|Priority||Single. The priority of the constraint. Must be in range [0, UILayoutPriority.Required].|
|[read-only]||Relation||NSLayoutRelation. The NSRelation that holds between the two items in the constraint.|
|[read-only]||SecondAttribute||NSLayoutAttribute. The attribute of the second item participating in the constraint.|
|[read-only]||SecondItem||NSObject. The second item participating in the constraint.|
|ShouldBeArchived||Boolean. Whether the constraint should be archived by its owning UIView.|