Press 'Space' to continue
Press 'n' to show/hide notes
Press 's' for speaker mode
Date |
Notes |
---|---|
2016-03-21 |
Added Changing Constraints chapter. |
2015-12-10 |
Added advanced recipes to the cookbook. Incorporated other minor updates. |
2015-09-16 |
Updated to include information about using Auto Layout with iOS size classes. Added many Auto Layout examples. |
2013-09-18 |
Updated to describe Auto Layout in Xcode 5. |
2012-09-19 |
Added to iOS Library. Added links to WWDC videos. |
2012-02-16 |
Corrected minor code error. |
2011-07-06 |
New document that describes the constraint-based system for laying out user interface elements. |
Some graphical elements like UILabel or UIButton need only 2 constraints (width and height are optional) since they can determine their size with the elements (text) they have.
Some constraints may be ambiguous. So we need to use hugging and compression resistance priority.
Original button: [ Click Me ]
Hugging priority > 500: [Click Me]
Hugging priority < 500: [ Click Me ]
Original button: [ Click Me ]
Compression resistance priority > 500: [Click Me]
Compression resistance priority < 500: [Cli..]
Use aspect ratio on flag (3:2) and center it on the view. You can use Embed in function.
Create a green view and put these constraints:
[NSLayoutConstraint constraintWithItem:view
attribute:NSLayoutAttributeLeading
relatedBy:NSLayoutRelationEqual
toItem:view.superview
attribute:NSLayoutAttributeLeading
multiplier:1.0 constant:8.0];
[NSLayoutConstraint
constraintsWithVisualFormat:@"H:|-15-[view]-15-|"
options:NSLayoutFormatAlignAllLeft
metrics:nil views:@{@"view":view}];
Embed in all the buttons in the menu view to a Scroll View and solve all the constraint errors.
Source Code: Click here
Github: benjdum59
Website: benjdum59.github.io
Mail: benjamin.dumont.pro@gmail.com
Go to Homepage