Title: Theory / Important / CS / Programming / Objective-C / Library / UIKit / View / Layout
Tags: automatedNewLineAfterCommaSpace variable
On every note of this deck, unless a note says otherwise:
Page: https://developer.apple.com/documentation/foundation/nsedgeinsets?language=objc

Instruction: match_parent
Page: https://developer.android.com/guide/topics/ui/declaring-layout
Language: Objective-C
Context: layout xml Height/Width
Returns: Tells your view to become as big as its parent view group will allow.

Typ: UILayoutPriority
Meaning: 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.
Page: https://developer.apple.com/library/archive/documentation/UserExperience/Conceptual/AutolayoutPG/AnatomyofaConstraint.html#//apple_ref/doc/uid/TP40010853-CH9-SW1
Language: Objective-C
Context: iOS UI

Typ: UILayoutGuide
Meaning: A rectangular area that can interact with Auto Layout.
Page: https://developer.apple.com/documentation/coregraphics?language=objc
Language: Objective-C
Context: iOS UI

Name: A placeholder view
Definition: an empty view that does not have any visual elements of its own and serves only to define a rectangular region in the view hierarchy.
Page: https://developer.apple.com/documentation/uikit/uilayoutguide?language=objc
Context: iOS UI

Question: Issues with placeholder view
Answer: the cost of creating and maintaining the view itself.
Page: https://developer.apple.com/documentation/uikit/uilayoutguide?language=objc
Context: iOS UI
Answer2: adds overhead to every task the hierarchy performs
Answer3: the invisible placeholder view can intercept messages that are intended for other views, causing problems that are very difficult to find.

Question: How to create a layout guide
Answer: Instantiate a new layout guide
Page: https://developer.apple.com/documentation/uikit/uilayoutguide?language=objc
Context: iOS UI
Answer2: call [view addLayoutGuide:layoutGuide]
Answer3: define the position and size of the layout guide using AutoLayout

Variable: layoutGuide.identifier
Meaning: A string used to identify the layout guide.
Page: https://developer.apple.com/documentation/uikit/uilayoutguide?language=objc
Context: iOS UI
Language: Objective-C
Variables: UILayoutGuide layoutGuide

Variable: layoutGuide.layoutFrame
Meaning: The layout guide’s frame in its owning view’s coordinate system.
Page: https://developer.apple.com/documentation/uikit/uilayoutguide?language=objc
Context: iOS UI
Language: Objective-C
Variables: UILayoutGuide layoutGuide

Variable: layoutGuide.owningView
Meaning: The view that owns this layout guide.
Page: https://developer.apple.com/documentation/uikit/uilayoutguide?language=objc
Context: iOS UI
Language: Objective-C
Variables: UILayoutGuide layoutGuide

Typ: UIKeyboardLayoutGuide
Meaning: A layout guide that represents the space the keyboard occupies in your app’s layout.
Page: https://developer.apple.com/documentation/uikit/uikeyboardlayoutguide?language=objc
Language: Objective-C
Context: iOS UI
Subtype of: UITrackingLayoutGuide

Variable: keyboardLayoutGuide.followsUndockedKeyboard
Meaning: whether the layout guide tracks the keyboard when it’s undocked from the bottom of the screen.
Page: https://developer.apple.com/documentation/uikit/uikeyboardlayoutguide?language=objc
Context: iOS UI
Language: Objective-C
Variables: UIKeyboardLayoutGuide keyboardLayoutGuide
Initialization: NO

Typ: UITrackingLayoutGuide
Meaning: A layout guide that automatically activates and deactivates layout constraints depending on its proximity to edges.
Page: https://developer.apple.com/documentation/uikit/uitrackinglayoutguide?language=objc
Language: Objective-C
Context: iOS UI
Subtype of: UILayoutGuide

Instruction: [trackingLayoutGuide
  removeAllTrackedConstraints
]
Page: https://developer.apple.com/documentation/uikit/uitrackinglayoutguide?language=objc
Effect: Stops the layout guide from tracking any constraints.
Language: Objective-C
Context: iOS UI
Variables: UITrackingLayoutGuide trackingLayoutGuide

Instruction: [trackingLayoutGuide
  constraintsActiveWhenAwayFromEdge:edge
]
Page: https://developer.apple.com/documentation/uikit/uitrackinglayoutguide?language=objc
Language: Objective-C
Context: iOS UI
Returns: the constraints that the tracking layout guide activates when it’s away from the given edge, and deactivates when it’s near the edge.
Variables: UITrackingLayoutGuide trackingLayoutGuide

Instruction: [trackingLayoutGuide
  setConstraints:trackingConstraints
  activieWhen(Near|Away)Edge:edge
]
Page: https://developer.apple.com/documentation/uikit/uitrackinglayoutguide?language=objc
Effect: Configures the tracking layout guide to automatically activate and deactivate constraints when the guide is (near to|away from) the given edge.
Language: Objective-C
Context: iOS UI
Variables: UITrackingLayoutGuide trackingLayoutGuide

Instruction: [trackingLayoutGuide
  constraintsActiveWhen(Near|Away)Edge:edge
]
Page: https://developer.apple.com/documentation/uikit/uitrackinglayoutguide?language=objc
Language: Objective-C
Context: iOS UI
Returns: the constraints that the tracking layout guide activates when it’s (near|away) the given edge, and deactivates when it’s (away|near) from the given edge.
Variables: UITrackingLayoutGuide trackingLayoutGuide

Typ: NSLayoutConstraint
Meaning: The relationship between two user interface objects that must be satisfied by the constraint-based layout system.
Page: https://developer.apple.com/documentation/uikit/nslayoutconstraint?language=objc
Language: Objective-C
Context: iOS UI
Implementation: item1.attribute1 = multiplier × item2.attribute2 + constant

Name: A valid layout
Definition: A set of constraint with a single solution
Page: https://developer.apple.com/documentation/uikit/nslayoutconstraint?language=objc
Context: iOS UI
Name2: A non ambiguous constraint
Name3: A nonconflicting layouts

Name: Unsatisfiuable layouts
Definition: A layout that has no valid solution
Page: https://developer.apple.com/documentation/uikit/nslayoutconstraint?language=objc
Context: iOS UI

Name: Ambiguous layouts
Definition: The layout needs additional constraints to uniquely specify the position and location of every view.
Page: https://developer.apple.com/documentation/uikit/nslayoutconstraint?language=objc
Context: iOS UI
Definition2: The layout has conflicting optional constraints with the same priority, and the system does not know which constraint it should break.

Name: A logical error
Definition: There is a bug in your layout logic
Page: https://developer.apple.com/documentation/uikit/nslayoutconstraint?language=objc
Context: iOS layout

Question: The type of layout errors
Answer: Unsatisfuable layout
Page: https://developer.apple.com/documentation/uikit/nslayoutconstraint?language=objc
Context: iOS layout
Answer2: Ambiguous layout
Answer3: Logical error

Question: How to debug ambiguous layout
Answer: hasHambiguousLayout
Answer2: exerciseAmbiguityInLayout
Answer3: constraintsAffectingLayoutForAxis (iOS only)
Answer4: constraintsAffectingLayoutForOrientation: (OS X only)
Answer5: _autolayoutTrace (iOS only)

Instruction: [NSLayoutCounstraint
  constraintsWithVisualFormat:format
  options:opts
  metrics:metrics
  views:views
]
Language: Objective-C
Returns: 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.

Instruction: [NSLayoutCounstraint
  constraintWithItem:view1
  attribute:attr1
  relatedBy:RELATION
  toItem:view2
  attribute:attr2
  multiplier:multiplier
  constant:c
]
Language: Objective-C
Returns: The constraint
view1.attr1 RELATION multiplier * view2.attr2 + c

Variable: layoutConstraint.active
Meaning: The active state of the constraint.
Page: https://developer.apple.com/documentation/uikit/nslayoutconstraint?language=objc
Language: Objective-C
Variables: NSLayoutConstraint layoutConstraint

Variable: layoutConstraint.(first|second)Item
Meaning: The first|second object participating in the constraint.
Page: https://developer.apple.com/documentation/uikit/nslayoutconstraint?language=objc
Language: Objective-C
Variables: NSLayoutConstraint layoutConstraint

Variable: layoutConstraint.relation
Meaning: The first object participating in the constraint.
Page: https://developer.apple.com/documentation/uikit/nslayoutconstraint?language=objc
Language: Objective-C
Variables: NSLayoutConstraint layoutConstraint

Variable: layoutConstraint.(first|second)Attribute
Meaning: The first|second attribute participating in the constraint.
Page: https://developer.apple.com/documentation/uikit/nslayoutconstraint?language=objc
Language: Objective-C
Variables: NSLayoutConstraint layoutConstraint

Variable: layoutConstraint.multiplier
Meaning: The multiprier of this constraint
Page: https://developer.apple.com/documentation/uikit/nslayoutconstraint?language=objc
Language: Objective-C
Variables: NSLayoutConstraint layoutConstraint

Variable: layoutConstraint.constant
Meaning: The constant added to the multiplied second attribute participating in the constraint
Page: https://developer.apple.com/documentation/uikit/nslayoutconstraint?language=objc
Language: Objective-C
Variables: NSLayoutConstraint layoutConstraint

Variable: layoutConstraint.(first|second)Anchor
Meaning: The (first|second) anchor that defines the constraint.
Page: https://developer.apple.com/documentation/uikit/nslayoutconstraint?language=objc
Language: Objective-C
Variables: NSLayoutConstraint layoutConstraint

Variable: layoutConstraint.priority
Meaning: The priority of the constraint.
Page: https://developer.apple.com/documentation/uikit/nslayoutconstraint?language=objc
Language: Objective-C
Variables: NSLayoutConstraint layoutConstraint

Variable: layoutConstraint.shouldBeArchived
Meaning: whether the constraint should be archived by its owning view
Page: https://developer.apple.com/documentation/uikit/nslayoutconstraint?language=objc
Language: Objective-C
Variables: NSLayoutConstraint layoutConstraint

Typ: NSEdgeInsets
Meaning: A description of the distance between the edges of two rectangles.
Page: https://developer.apple.com/documentation/uikit/nslayoutconstraint?language=objc
Language: Objective-C

Typ: NSLayoutConstraintOrientation
TypMeaning: The layout constraint orientation, either horizontal or vertical, that the constraint uses to enforce layout between objects.
Page: https://developer.apple.com/documentation/uikit/nslayoutconstraint?language=objc
Language: Objective-C
Value: NSLayoutConstraintOrientation(Horizontal|Vertical)
The constraint orientation applied to laying out the (horizontal|vertical) relationship between objects.

Typ: NSLayoutFormatOptions
Meaning: A bit mask that specifies both a part of an interface element to align and a direction for the alignment between two interface elements.
Page: https://developer.apple.com/documentation/uikit/nslayoutconstraint?language=objc
Language: TODO

Typ: NSLayoutAttribute
TypMeaning: The part of the object’s visual representation that should be used to get the value for the constraint.
Page: https://developer.apple.com/documentation/uikit/nslayoutconstraint?language=objc
Language: Objective-C
Value: NSLayoutAttribute(Left|Right|Top|Bottom|Leading|Trailing)(|Margin)
Value2: NSLayoutAttribute(Width|Height)
Value3: NSLayoutAttribute(Last|First|)Baseline
Value4: NSLayoutAttributeNotAnAttribute
Value5: NSLayoutAttribute(CenterX|CenterY)(|WithinMargin)

Typ: NSLayoutRelation
TypMeaning: The relation between the first attribute and the modified second attribute in a constraint.
Page: https://developer.apple.com/documentation/uikit/nslayoutconstraint?language=objc
Language: Objective-C
Value: NSLayoutRelationLessThanOrEqual
NSLayoutRelationGreaterThanOrEqual
NSLayoutRelationEqual

Typ: NSLayoutPriority
Meaning: Layout priority used to indicate the relative importance of constraints, allowing Auto Layout to make appropriate tradeoffs when satisfying the constraints of the system as a whole.
Page: https://developer.apple.com/documentation/uikit/nslayoutconstraint?language=objc
Language: Objective-C

Instruction: [NSLayoutConstraint
  (de|)activeConstraints:constraints
]
Page: https://developer.apple.com/documentation/uikit/nslayoutconstraint?language=objc
Effect: (de|)activate constraints
Language: Objective-C

Constant: NSLayoutPriorityRequired
Meaning: A required constraint
Language: Objective-C
Context: NSLayoutPriorityConstraint

Constant: NSLayoutPriorityDefaultHigh
Meaning: Priority level with which a button resists compressing its content.
Language: Objective-C
Context: NSLayoutPriorityConstraint

Constant: NSLayoutPriorityDragThatCanResizeWindow
Meaning: Appropriate priority level for a drag that may end up resizing the window.
Language: Objective-C
Context: NSLayoutPriorityConstraint
Extra: This drag does not need to explicitly resize the window. The user might be dragging around window contents, and it might be desirable for the window get bigger to accommodate those contents.

Constant: NSLayoutPriorityWindowSizeStayPut
Meaning: Priority level for the window’s current size.
Language: Objective-C
Context: NSLayoutPriorityConstraint
Assuming: It's generally not appropriate to make a constraint at exactly this priority. You want to be higher or lower. Constraints with higher priorities can adjust the window’s size. Constraints with lower priorities must be fulfilled using the current window size.

Constant: NSLayoutPriorityDragThatCannotResizeWindow
Meaning: Priority level at which a split view divider, say, is dragged.
Language: Objective-C
Context: NSLayoutPriorityConstraint
Extra: A constraint with this priority cannot resize the window.

Constant: NSLayoutPriorityDefaultLow
Meaning: Priority level at which a button hugs its contents horizontally
Language: Objective-C
Context: NSLayoutPriorityConstraint

Constant: NSLayoutPriorityFittingSizeCompression
Meaning: When you send a fittingSize message to a view, the smallest size that is large enough for the view's contents is computed.
Language: Objective-C
Context: NSLayoutPriorityConstraint
Assuming: This is the priority level with which the view wants to be as small as possible 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.

Constant: UILayoutPriorityFittingSizeLevel
Meaning: The priority level with which the view wants to conform to the target size in that computation.
Language: Objective-C
Context: NSLayoutPriorityConstraint
Assuming: When you send a systemLayoutSizeFittingSize: message to a view, the size fitting most closely to the target size is computed. This priority is quite low. It is generally not appropriate to make a constraint at exactly this priority. You want to be higher or lower.

Constant: UILayoutPriorityDefaultLow
Meaning: The priority level at which a button hugs its contents horizontally.
Language: Objective-C
Context: NSLayoutPriorityConstraint

Constant: UILayoutPriorityDefaultHigh
Meaning: The priority level with which a button resists compressing its content.
Language: Objective-C
Context: NSLayoutPriorityConstraint

Constant: UILayoutPriorityRequired
Meaning: A required constraint.
Language: Objective-C
Context: NSLayoutPriorityConstraint
Extra: Do not specify a layout constraint that exceeds this number.

Typ: UILayoutSupport
Function: length
Page: https://developer.apple.com/documentation/foundation/nsedgeinsets?language=objc
Function2: heightAnchor
Context: iOS UI
Function3: (bottom|top)Anchor
Language: Objective-C

Instruction: NSDictionaryOfVariableBindings(
  value1,
  ...,
  valuen
)
Page: https://developer.apple.com/documentation/foundation/nsedgeinsets?language=objc
Effect: A dictionnarry associating @"valuei" to valuei
Language: Objective-C
Context: iOS UI
Typ: UILayoutSupport

Typ: NSLayoutDimension
Meaning: A factory class for creating size-based layout constraint objects using a fluent API.
Page: https://developer.apple.com/documentation/foundation/nsedgeinsets?language=objc
Language: Objective-C
Context: iOS UI

Instruction: [layoutDimension
  constraint(GreaterThanOr|LessThanOr|)EqualToAnchor:anchor
  multiplier:multiplier
  (constant:constant)
]
Page: https://developer.apple.com/documentation/foundation/nsedgeinsets?language=objc
Language: Objective-C
Context: iOS UI
Returns: The constraint
layoutDimension (GreaterThanOr|LessThanOr|)EQUAL multiplier * anchor + constant
Variables: NSLayoutDimension layoutDimension

Instruction: [layoutDimension
  constraint(GreaterThanOr|LessThanOr|)EqualToConstant:constant
]
Page: https://developer.apple.com/documentation/foundation/nsedgeinsets?language=objc
Language: Objective-C
Context: iOS UI
Returns: The constraint
layoutDimension (GreaterThanOr|LessThanOr|)Equal constant
Variables: NSLayoutDimension layoutDimension

Typ: NSLayoutAnchor
Meaning: A factory class for creating layout constraint objects using a fluent API.
Page: https://developer.apple.com/documentation/uikit/nslayoutanchor?language=objc
Language: Objective-C
Context: iOS UI

Instruction: [layoutAnchor
  constraint(GreaterThanOr|LessThanOr|)EqualToAnchor:anchor
  (constant:constant)
]
Page: https://developer.apple.com/documentation/uikit/nslayoutanchor?language=objc
Language: Objective-C
Context: iOS UI
Returns: NSLayoutConstraint layoutAnchor <=> anchor + constant
Variables: NSLayoutAnchor layoutAnchor

Typ: NSLayout(X|Y)AxisAnchor
Meaning: A factory class for creating (horizontal|vertical) layout constraint objects using a fluent API.
Page: https://developer.apple.com/documentation/uikit/nslayoutanchor?language=objc
Language: Objective-C
Context: iOS UI

Instruction: [layoutXAxisAnchor
  constraint(GreaterThanOr|LessThanOr|)EqualToSystemSpacingAfterAnchor:anchor
  multiplier:multiplier
]
Page: https://developer.apple.com/documentation/uikit/nslayoutanchor?language=objc
Language: Objective-C
Context: iOS UI
Returns: a constraint that defines by how much the current anchor trails the specified anchor.
Variables: NSLayoutXAxisAnchor layoutXAxisAnchor
Typ: NSLayoutXAxisAnchor

Instruction: [layoutAxisAnchor
  anchorWithOffsetToAnchor:otherAnchor
]
Page: https://developer.apple.com/documentation/uikit/nslayoutanchor?language=objc
Language: Objective-C
Context: iOS UI
Returns: The NSLayoutDimension object represented by the two anchors.
Variables: NSLayout(X|Y)AxisAnchor layoutAxisAnchor

Instruction: [layoutXAxisAnchor
  constraint(GreaterThanOr|LessThanOr|)EqualToSystemSpacingBelowAnchor:anchor
  multiplier:multiplier
]
Page: https://developer.apple.com/documentation/uikit/nslayoutanchor?language=objc
Language: Objective-C
Context: iOS UI
Returns: a constraint that defines by how much the current anchor is below the specified anchor.
Variables: NSLayoutXAxisAnchor layoutXAxisAnchor
Typ: NSLayoutXAxisAnchor

Variable: layoutAnchor.constraintsAffectingLayout
Meaning: The constraints that impact the layout of the anchor.
Page: https://developer.apple.com/documentation/uikit/nslayoutanchor?language=objc
Context: iOS UI
Language: Objective-C
Variables: NSLayoutAnchor layoutAnchor

Variable: layoutAnchor.hasAmbiguousLayout
Meaning: whether the constraints impacting the anchor specify its location ambiguously.
Page: https://developer.apple.com/documentation/uikit/nslayoutanchor?language=objc
Context: iOS UI
Language: Objective-C
Variables: NSLayoutAnchor layoutAnchor

Variable: layoutAnchor.name
Meaning: The name assigned to the anchor
Page: https://developer.apple.com/documentation/uikit/nslayoutanchor?language=objc
Context: iOS UI
Language: Objective-C
Variables: NSLayoutAnchor layoutAnchor
Assuming: for debugging purposes.

Variable: layoutAnchor.item
Meaning: The layout item used to calculate the anchor's position.
Page: https://developer.apple.com/documentation/uikit/nslayoutanchor?language=objc
Context: iOS UI
Language: Objective-C
Variables: NSLayoutAnchor layoutAnchor