iOS Developer Library — Pre-Release

Developer

UIKit Framework Reference NSLayoutConstraint Class Reference

Options
Deployment Target:

On This Page
Language:

NSLayoutConstraint

A constraint defines a relationship between two user interface objects that must be satisfied by the constraint-based layout system. Each constraint is a linear equation with the following format:

  • item1.attribute1 = multiplier × item2.attribute2 + constant

In this equation, attribute1 and attribute2 are the variables that Auto Layout can adjust when solving these constraints. The other values are defined when you create the constraint. For example, If you’re defining the relative position of two buttons, you might say “the leading edge of the second button should be 8 points after the trailing edge of the first button.” The linear equation for this relationship is shown below:

  • // positive values move to the right in left-to-right languages like English.
  • button2.leading = 1.0 × button1.trailing + 8.0

Auto Layout then modifies the values of the specified leading and trailing edges until both sides of the equation are equal. Note that Auto Layout does not simply assign the value of the right side of this equation to the left side. Instead, the system can modify either attribute or both attributes as needed to solve for this constraint.

The fact that constraints are equations (and not assignment operators) means that you can switch the order of the items in the equation as needed to more clearly express the desired relationship. However, if you switch the order, you must also invert the multiplier and constant. For example, the following two equations produce identical constraints:

  • // These equations produce identical constraints
  • button2.leading = 1.0 × button1.trailing + 8.0
  • button1.trailing = 1.0 × button2.leading - 8.0

A valid layout is defined as a set constraints with one and only one possible solution. Valid layouts are also referred to as a nonambiguous, nonconflicting layouts. Constraints with more than one solution are ambiguous. Constraints with no valid solutions are conflicting. For more information on resolving ambiguous and conflicting constraints, see Resolving Auto Layout Issues in Auto Layout Guide..

Additionally, constraints are not limited to equality relationships. They can also use greater than or equal to (>=) or less than or equal to (<=) to describe the relationship between the two attributes. Constraints also have priorities between 1 and 1,000. Constraints with a priority of 1,000 are required. All priorities less than 1,000 are optional. By default, all constraints are required (priority = 1,000).

After solving for the required constraints, Auto Layout tries to solve all the optional constraints in priority order from highest to lowest. If it cannot solve for an optional constraint, it tries to come as close as possible to the desired result, and then moves on to the next constraint.

This combination of inequalities, equalities, and priorities gives you a great amount of flexibility and power. By combining multiple constraints, you can define layouts that dynamically adapt as the size and location of the elements in your user interface change.

Inheritance


Conforms To


Import Statement


Swift

import UIKit

Objective-C

@import UIKit;

Availability


Available in iOS 6.0 and later.
  • Creates constraints described by an ASCII art-like visual format string.

    Declaration

    Swift

    class func constraintsWithVisualFormat(_ format: String, options opts: NSLayoutFormatOptions, metrics metrics: [NSObject : AnyObject]?, views views: [NSObject : AnyObject]) -> [AnyObject]

    Objective-C

    + (NSArray *)constraintsWithVisualFormat:(NSString *)format options:(NSLayoutFormatOptions)opts metrics:(NSDictionary *)metrics views:(NSDictionary *)views

    Parameters

    format

    The format specification for the constraints. For more information, see Visual Format Language in Auto Layout Guide.

    opts

    Options describing the attribute and the direction of layout for all objects in the visual format string.

    metrics

    A dictionary of constants that appear in the visual format string. The dictionary’s keys must be the string values used in the visual format string. Their values must be NSNumber objects.

    views

    A dictionary of views that appear in the visual format string. The keys must be the string values used in the visual format string, and the values must be the view objects.

    Return Value

    An array of constraints that, combined, express the constraints between the provided views and their parent view as described by the visual format string. The constraints are returned in the same order they were specified in the visual format string.

    Discussion

    The language used for the visual format string is described in Visual Format Language in Auto Layout Guide.

    Import Statement

    Objective-C

    @import UIKit;

    Swift

    import UIKit

    Availability

    Available in iOS 6.0 and later.

  • Creates a constraint that defines the relationship between the specified attributes of the given views.

    Declaration

    Swift

    convenience init(item view1: AnyObject, attribute attr1: NSLayoutAttribute, relatedBy relation: NSLayoutRelation, toItem view2: AnyObject?, attribute attr2: NSLayoutAttribute, multiplier multiplier: CGFloat, constant c: CGFloat)

    Objective-C

    + (instancetype)constraintWithItem:(id)view1 attribute:(NSLayoutAttribute)attr1 relatedBy:(NSLayoutRelation)relation toItem:(id)view2 attribute:(NSLayoutAttribute)attr2 multiplier:(CGFloat)multiplier constant:(CGFloat)c

    Parameters

    view1

    The view for the left side of the constraint.

    attr1

    The attribute of the view for the left side of the constraint.

    relation

    The relationship between the left side of the constraint and the right side of the constraint.

    view2

    The view for the right side of the constraint.

    attr2

    The attribute of the view for the right side of the constraint.

    multiplier

    The constant multiplied with the attribute on the right side of the constraint as part of getting the modified attribute.

    c

    The constant added to the multiplied attribute value on the right side of the constraint to yield the final modified attribute.

    Return Value

    A constraint object relating the two provided views with the specified relation, attributes, multiplier, and constant.

    Discussion

    Constraints represent linear equations of the form view1.attr1 <relation> multiplier × view2.attr2 + c. If the constraint you wish to express does not have a second view and attribute, use nil and NSLayoutAttributeNotAnAttribute.

    Import Statement

    Objective-C

    @import UIKit;

    Swift

    import UIKit

    Availability

    Available in iOS 6.0 and later.

  • active active Property

    The active state of the constraint.

    Declaration

    Swift

    var active: Bool

    Objective-C

    @property(getter=isActive) BOOL active

    Discussion

    You can activate or deactivate a constraint by changing this property. Note that only active constraints affect the calculated layout. If you try to activate a constraint whose items have no common ancestor, an exception is thrown. For newly created constraints, the active property is NOfalse by default.

    Activating or deactivating the constraint calls addConstraint: and removeConstraint: on the view that is the closest common ancestor of the items managed by this constraint. Use this property instead of calling addConstraint: or removeConstraint: directly.

    Import Statement

    Objective-C

    @import UIKit;

    Swift

    import UIKit

    Availability

    Available in iOS 8.0 and later.

  • Activates each constraint in the specified array.

    Declaration

    Objective-C

    + (void)activateConstraints:(NSArray *)constraints

    Parameters

    constraints

    An array of constraints to activate.

    Discussion

    This convenience method provides an easy way to activate a set of constraints with one call. The effect of this method is the same as setting the active property of each constraint to YEStrue. Typically, using this method is more efficient than activating each constraint individually.

  • Deactivates each constraint in the specified array.

    Declaration

    Objective-C

    + (void)deactivateConstraints:(NSArray *)constraints

    Parameters

    constraints

    An array of constraints to deactivate.

    Discussion

    This is a convenience method that provides an easy way to deactivate a set of constraints with one call. The effect of this method is the same as setting the active property of each constraint to NOfalse. Typically, using this method is more efficient than deactivating each constraint individually.

  • priority priority Property

    The priority of the constraint.

    Declaration

    Swift

    var priority: UILayoutPriority

    Objective-C

    @property UILayoutPriority priority

    Discussion

    If a constraint's priority level is less than UILayoutPriorityRequired in OS X or UILayoutPriorityRequired in iOS, then it is optional. Higher priority constraints are met before lower priority constraints.

    Constraint satisfaction is not all or nothing. If a constraint a == b is optional, the constraint-based layout system will attempt to minimize abs(a-b).

    Priorities may not change from nonrequired to required, or from required to nonrequired. An exception will be thrown if a priority of NSLayoutPriorityRequired in OS X or UILayoutPriorityRequired in iOS is changed to a lower priority, or if a lower priority is changed to a required priority after the constraints is added to a view. Changing from one optional priority to another optional priority is allowed even after the constraint is installed on a view.

    Priorities must be greater than 0 and less than or equal to NSLayoutPriorityRequired in OS X or UILayoutPriorityRequired in iOS.

    Import Statement

    Objective-C

    @import UIKit;

    Swift

    import UIKit

    Availability

    Available in iOS 6.0 and later.

  • firstItem firstItem Property

    The first object participating in the constraint.

    Declaration

    Swift

    unowned(unsafe) var firstItem: AnyObject { get }

    Objective-C

    @property(readonly, assign) id firstItem

    Import Statement

    Objective-C

    @import UIKit;

    Swift

    import UIKit

    Availability

    Available in iOS 6.0 and later.

  • The attribute of the first object participating in the constraint.

    Declaration

    Swift

    var firstAttribute: NSLayoutAttribute { get }

    Objective-C

    @property(readonly) NSLayoutAttribute firstAttribute

    Import Statement

    Objective-C

    @import UIKit;

    Swift

    import UIKit

    Availability

    Available in iOS 6.0 and later.

  • relation relation Property

    The relation between the two attributes in the constraint.

    Declaration

    Swift

    var relation: NSLayoutRelation { get }

    Objective-C

    @property(readonly) NSLayoutRelation relation

    Import Statement

    Objective-C

    @import UIKit;

    Swift

    import UIKit

    Availability

    Available in iOS 6.0 and later.

  • The second object participating in the constraint.

    Declaration

    Swift

    unowned(unsafe) var secondItem: AnyObject? { get }

    Objective-C

    @property(readonly, assign) id secondItem

    Import Statement

    Objective-C

    @import UIKit;

    Swift

    import UIKit

    Availability

    Available in iOS 6.0 and later.

  • The attribute of the second object participating in the constraint.

    Declaration

    Swift

    var secondAttribute: NSLayoutAttribute { get }

    Objective-C

    @property(readonly) NSLayoutAttribute secondAttribute

    Import Statement

    Objective-C

    @import UIKit;

    Swift

    import UIKit

    Availability

    Available in iOS 6.0 and later.

  • The multiplier applied to the second attribute participating in the constraint.

    Declaration

    Swift

    var multiplier: CGFloat { get }

    Objective-C

    @property(readonly) CGFloat multiplier

    Import Statement

    Objective-C

    @import UIKit;

    Swift

    import UIKit

    Availability

    Available in iOS 6.0 and later.

  • constant constant Property

    The constant added to the multiplied second attribute participating in the constraint.

    Declaration

    Swift

    var constant: CGFloat

    Objective-C

    @property CGFloat constant

    Discussion

    Unlike the other properties, the constant can be modified after constraint creation. Setting the constant on an existing constraint performs much better than removing the constraint and adding a new one that's exactly like the old except that it has a different constant.

    Import Statement

    Objective-C

    @import UIKit;

    Swift

    import UIKit

    Availability

    Available in iOS 6.0 and later.

  • The name that identifies the constraint.

    Declaration

    Swift

    var identifier: String?

    Objective-C

    @property(copy) NSString *identifier

    Discussion

    A constraint’s identifier is available in its description. Identifiers that start with NS are reserved by the system.

    Import Statement

    Objective-C

    @import UIKit;

    Swift

    import UIKit

    Availability

    Available in iOS 7.0 and later.

  • A Boolean value that determines whether the constraint should be archived by its owning view.

    Declaration

    Swift

    var shouldBeArchived: Bool

    Objective-C

    @property BOOL shouldBeArchived

    Discussion

    When a view is archived, it archives some but not all constraints in its constraints array. The value of shouldBeArchived informs the view if a particular constraint should be archived by the view.

    If a constraint is created at runtime in response to the state of the object, it isn't appropriate to archive the constraint. Instead you archive the state that gives rise to the constraint. The default value for this property is NOfalse.

    Import Statement

    Objective-C

    @import UIKit;

    Swift

    import UIKit

    Availability

    Available in iOS 6.0 and later.

  • The relation between the first attribute and the modified second attribute in a constraint.

    Declaration

    Swift

    enum NSLayoutRelation : Int { case LessThanOrEqual case Equal case GreaterThanOrEqual }

    Objective-C

    enum { NSLayoutRelationLessThanOrEqual = -1, NSLayoutRelationEqual = 0, NSLayoutRelationGreaterThanOrEqual = 1, }; typedef NSInteger NSLayoutRelation;

    Constants

    • LessThanOrEqual

      NSLayoutRelationLessThanOrEqual

      The constraint requires the first attribute to be less than or equal to the modified second attribute.

      Available in iOS 6.0 and later.

    • Equal

      NSLayoutRelationEqual

      The constraint requires the first attribute to be exactly equal to the modified second attribute.

      Available in iOS 6.0 and later.

    • GreaterThanOrEqual

      NSLayoutRelationGreaterThanOrEqual

      The constraint requires the first attribute to be greater than or equal to the modified second attribute.

      Available in iOS 6.0 and later.

    Import Statement

    Objective-C

    @import UIKit;

    Swift

    import UIKit

    Availability

    Available in iOS 6.0 and later.

  • The part of the object’s visual representation that should be used to get the value for the constraint.

    Declaration

    Swift

    enum NSLayoutAttribute : Int { case Left case Right case Top case Bottom case Leading case Trailing case Width case Height case CenterX case CenterY case Baseline case FirstBaseline case LeftMargin case RightMargin case TopMargin case BottomMargin case LeadingMargin case TrailingMargin case CenterXWithinMargins case CenterYWithinMargins case NotAnAttribute }

    Objective-C

    typedef enum: NSInteger { NSLayoutAttributeLeft = 1, NSLayoutAttributeRight, NSLayoutAttributeTop, NSLayoutAttributeBottom, NSLayoutAttributeLeading, NSLayoutAttributeTrailing, NSLayoutAttributeWidth, NSLayoutAttributeHeight, NSLayoutAttributeCenterX, NSLayoutAttributeCenterY, NSLayoutAttributeBaseline, NSLayoutAttributeLastBaseline = NSLayoutAttributeBaseline, NSLayoutAttributeFirstBaseline, NSLayoutAttributeLeftMargin, NSLayoutAttributeRightMargin, NSLayoutAttributeTopMargin, NSLayoutAttributeBottomMargin, NSLayoutAttributeLeadingMargin, NSLayoutAttributeTrailingMargin, NSLayoutAttributeCenterXWithinMargins, NSLayoutAttributeCenterYWithinMargins, NSLayoutAttributeNotAnAttribute = 0 } NSLayoutAttribute;

    Constants

    • Left

      NSLayoutAttributeLeft

      The left side of the object’s alignment rectangle.

      Available in iOS 6.0 and later.

    • Right

      NSLayoutAttributeRight

      The right side of the object’s alignment rectangle.

      Available in iOS 6.0 and later.

    • Top

      NSLayoutAttributeTop

      The top of the object’s alignment rectangle.

      Available in iOS 6.0 and later.

    • Bottom

      NSLayoutAttributeBottom

      The bottom of the object’s alignment rectangle.

      Available in iOS 6.0 and later.

    • Leading

      NSLayoutAttributeLeading

      The leading edge of the object’s alignment rectangle.

      Available in iOS 6.0 and later.

    • Trailing

      NSLayoutAttributeTrailing

      The trailing edge of the object’s alignment rectangle.

      Available in iOS 6.0 and later.

    • Width

      NSLayoutAttributeWidth

      The width of the object’s alignment rectangle.

      Available in iOS 6.0 and later.

    • Height

      NSLayoutAttributeHeight

      The height of the object’s alignment rectangle.

      Available in iOS 6.0 and later.

    • CenterX

      NSLayoutAttributeCenterX

      The center along the x-axis of the object’s alignment rectangle.

      Available in iOS 6.0 and later.

    • CenterY

      NSLayoutAttributeCenterY

      The center along the y-axis of the object’s alignment rectangle.

      Available in iOS 6.0 and later.

    • Baseline

      NSLayoutAttributeBaseline

      The object’s baseline.

      Available in iOS 6.0 and later.

    • NSLayoutAttributeLastBaseline

      NSLayoutAttributeLastBaseline

      The object’s baseline. For objects with more than one line of text, this is the baseline for the bottommost line of text.

      Available in iOS 8.0 and later.

    • FirstBaseline

      NSLayoutAttributeFirstBaseline

      The object’s baseline. For objects with more than one line of text, this is the baseline for the topmost line of text.

      Available in iOS 8.0 and later.

    • LeftMargin

      NSLayoutAttributeLeftMargin

      The object’s left margin. For UIView objects, the margins are defined by their layoutMargins property.

      Available in iOS 8.0 and later.

    • RightMargin

      NSLayoutAttributeRightMargin

      The object’s right margin. For UIView objects, the margins are defined by their layoutMargins property.

      Available in iOS 8.0 and later.

    • TopMargin

      NSLayoutAttributeTopMargin

      The object’s top margin. For UIView objects, the margins are defined by their layoutMargins property.

      Available in iOS 8.0 and later.

    • BottomMargin

      NSLayoutAttributeBottomMargin

      The object’s bottom margin. For UIView objects, the margins are defined by their layoutMargins property.

      Available in iOS 8.0 and later.

    • LeadingMargin

      NSLayoutAttributeLeadingMargin

      The object’s leading margin. For UIView objects, the margins are defined by their layoutMargins property.

      Available in iOS 8.0 and later.

    • TrailingMargin

      NSLayoutAttributeTrailingMargin

      The object’s trailing margin. For UIView objects, the margins are defined by their layoutMargins property.

      Available in iOS 8.0 and later.

    • CenterXWithinMargins

      NSLayoutAttributeCenterXWithinMargins

      The center along the x-axis between the object’s left and right margin. For UIView objects, the margins are defined by their layoutMargins property.

      Available in iOS 8.0 and later.

    • CenterYWithinMargins

      NSLayoutAttributeCenterYWithinMargins

      The center along the y-axis between the object’s top and bottom margin. For UIView objects, the margins are defined by their layoutMargins property.

      Available in iOS 8.0 and later.

    • NotAnAttribute

      NSLayoutAttributeNotAnAttribute

      A placeholder value that is used to indicate that the constraint’s second item and second attribute are not used in any calculations. Use this value when creating a constraint that assigns a constant to an attribute. For example, item1.height >= 40. If a constraint only has one item, set the second item to nil, and set the second attribute to NSLayoutAttributeNotAnAttribute.

      Available in iOS 6.0 and later.

    Import Statement

    Objective-C

    @import UIKit;

    Swift

    import UIKit

    Availability

    Available in iOS 6.0 and later.

  • A bit mask that specifies both a part of an interface element to align and a direction for the alignment between two interface elements.

    Declaration

    Swift

    struct NSLayoutFormatOptions : RawOptionSetType { init(_ rawValue: UInt) init(rawValue rawValue: UInt) static var AlignAllLeft: NSLayoutFormatOptions { get } static var AlignAllRight: NSLayoutFormatOptions { get } static var AlignAllTop: NSLayoutFormatOptions { get } static var AlignAllBottom: NSLayoutFormatOptions { get } static var AlignAllLeading: NSLayoutFormatOptions { get } static var AlignAllTrailing: NSLayoutFormatOptions { get } static var AlignAllCenterX: NSLayoutFormatOptions { get } static var AlignAllCenterY: NSLayoutFormatOptions { get } static var AlignAllBaseline: NSLayoutFormatOptions { get } static var AlignAllLastBaseline: NSLayoutFormatOptions { get } static var AlignAllFirstBaseline: NSLayoutFormatOptions { get } static var AlignmentMask: NSLayoutFormatOptions { get } static var DirectionLeadingToTrailing: NSLayoutFormatOptions { get } static var DirectionLeftToRight: NSLayoutFormatOptions { get } static var DirectionRightToLeft: NSLayoutFormatOptions { get } static var DirectionMask: NSLayoutFormatOptions { get } }

    Objective-C

    enum { /* choose only one of these */ NSLayoutFormatAlignAllLeft = NSLayoutAttributeLeft, NSLayoutFormatAlignAllRight = NSLayoutAttributeRight, NSLayoutFormatAlignAllTop = NSLayoutAttributeTop, NSLayoutFormatAlignAllBottom = NSLayoutAttributeBottom, NSLayoutFormatAlignAllLeading = NSLayoutAttributeLeading, NSLayoutFormatAlignAllTrailing = NSLayoutAttributeTrailing, NSLayoutFormatAlignAllCenterX = NSLayoutAttributeCenterX, NSLayoutFormatAlignAllCenterY = NSLayoutAttributeCenterY, NSLayoutFormatAlignAllBaseline = NSLayoutAttributeBaseline, NSLayoutFormatAlignmentMask = 0xFF, /* choose only one of these three */ NSLayoutFormatDirectionLeadingToTrailing = 0 << 8, // default NSLayoutFormatDirectionLeftToRight = 1 << 8, NSLayoutFormatDirectionRightToLeft = 2 << 8, NSLayoutFormatDirectionMask = 0x3 << 8, }; typedef NSUInteger NSLayoutFormatOptions;

    Constants

    • AlignAllLeft

      NSLayoutFormatAlignAllLeft

      Align all specified interface elements using NSLayoutAttributeLeft on each.

      Available in iOS 6.0 and later.

    • AlignAllRight

      NSLayoutFormatAlignAllRight

      Align all specified interface elements using NSLayoutAttributeRight on each.

      Available in iOS 6.0 and later.

    • AlignAllTop

      NSLayoutFormatAlignAllTop

      Align all specified interface elements using NSLayoutAttributeTop on each.

      Available in iOS 6.0 and later.

    • AlignAllBottom

      NSLayoutFormatAlignAllBottom

      Align all specified interface elements using NSLayoutAttributeBottom on each.

      Available in iOS 6.0 and later.

    • AlignAllLeading

      NSLayoutFormatAlignAllLeading

      Align all specified interface elements using NSLayoutAttributeLeading on each.

      Available in iOS 6.0 and later.

    • AlignAllTrailing

      NSLayoutFormatAlignAllTrailing

      Align all specified interface elements using NSLayoutAttributeTrailing on each.

      Available in iOS 6.0 and later.

    • AlignAllCenterX

      NSLayoutFormatAlignAllCenterX

      Align all specified interface elements using NSLayoutAttributeCenterX on each.

      Available in iOS 6.0 and later.

    • AlignAllCenterY

      NSLayoutFormatAlignAllCenterY

      Align all specified interface elements using NSLayoutAttributeCenterY on each.

      Available in iOS 6.0 and later.

    • AlignAllBaseline

      NSLayoutFormatAlignAllBaseline

      Align all specified interface elements using NSLayoutAttributeBaseline on each.

      Available in iOS 6.0 and later.

    • AlignmentMask

      NSLayoutFormatAlignmentMask

      Bit mask that can be combined with a NSLayoutFormatOptions variable to yield only the alignment portion of the format options.

      Available in iOS 6.0 and later.

    • DirectionLeadingToTrailing

      NSLayoutFormatDirectionLeadingToTrailing

      Arrange objects in order based on the normal text flow for the current user interface language. In left-to-right languages (like English), this arrangement results in the first object being placed farthest to the left, the next one to its right, and so on. In right-to-left languages (like Arabic or Hebrew), the ordering is reversed.

      Available in iOS 6.0 and later.

    • DirectionLeftToRight

      NSLayoutFormatDirectionLeftToRight

      Arrange objects in order from left to right.

      Available in iOS 6.0 and later.

    • DirectionRightToLeft

      NSLayoutFormatDirectionRightToLeft

      Arrange objects in order from right to left.

      Available in iOS 6.0 and later.

    • DirectionMask

      NSLayoutFormatDirectionMask

      Bit mask that can be combined with a NSLayoutFormatOptions variable to yield only the direction portion of the format options.

      Available in iOS 6.0 and later.

    Import Statement

    Objective-C

    @import UIKit;

    Swift

    import UIKit

    Availability

    Available in iOS 6.0 and later.

  • The layout priority is used to indicate to the constraint-based layout system which constraints are more important, allowing the system to make appropriate tradeoffs when satisfying the constraints of the system as a whole.

    Declaration

    Swift

    typealias UILayoutPriority = Float

    Objective-C

    enum { UILayoutPriorityRequired = 1000, UILayoutPriorityDefaultHigh = 750, UILayoutPriorityDefaultLow = 250, UILayoutPriorityFittingSizeLevel = 50, }; typedef float UILayoutPriority;

    Constants

    • UILayoutPriorityRequired

      UILayoutPriorityRequired

      A required constraint. Do not specify a layout constraint that exceeds this number.

      Available in iOS 6.0 through iOS 7.1.

    • UILayoutPriorityDefaultHigh

      UILayoutPriorityDefaultHigh

      This is the priority level with which a button resists compressing its content.

      Available in iOS 6.0 through iOS 7.1.

    • UILayoutPriorityDefaultLow

      UILayoutPriorityDefaultLow

      This is the priority level at which a button hugs its contents horizontally.

      Available in iOS 6.0 through iOS 7.1.

    • UILayoutPriorityFittingSizeLevel

      UILayoutPriorityFittingSizeLevel

      When you send a systemLayoutSizeFittingSize: message to a view, the size fitting most closely to the target size is computed. This is the priority level with which the view wants to conform to the target size in that computation. It's quite low. It is generally not appropriate to make a constraint at exactly this priority. You want to be higher or lower.

      Available in iOS 6.0 through iOS 7.1.

    Import Statement

    Objective-C

    @import UIKit;

    Swift

    import UIKit

    Availability

    Available in iOS 6.0 and later.