Auto layout

1,412 views
1,276 views

Published on

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,412
On SlideShare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
23
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Auto layout

  1. 1. AUTO LAYOUT IN IOS 7 Steveice
  2. 2. WE TALK ABOUT XCODE 5 FIRST
  3. 3. New Feature in Xcode 5 Source Control -> 隨時可以追蹤誰改的程式碼 Automatic Configuration -> Provision   Capabilities -> iCloud, GameCenter, Map-kit  Interface Design -> Auto Layout  Asset Catalog -> Image Slicing 如果根據命名規則 Xcode會 ⾃自動幫你分類 Apple LLVM5 Compiler
  4. 4. New Feature in Xcode 5 Add Modules -> Webkit.h, MapKIt.h, UIKit.h Automatically link frameworks Faster Build Build in CommandLineTool
  5. 5. AUTO LAYOUT IS A CONSTRAINT-BASED, DESCRIPTIVE LAYOUT SYSTEM.
  6. 6. Auto Layout Constraint-Based: 基於約束性 Descriptive Layout System: 敘述性佈局系統
  7. 7. A constraint is basically a statement of the form y = m*x + b y and x are attributes of views. An attribute is one of left, right, top, bottom, leading, trailing, width, height, centerX, centerY, and baseline. m and b are floating point values. button1.right == button2.left - 12.0 Constrain
  8. 8. Constrain [NSLayoutConstraint constraintWithItem:button attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:superview attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-padding] item1.attribute = multiplier ⨉ item2.attribute + constant
  9. 9. Visual Format Language
  10. 10. Visual Format Language [NSLayoutConstraint constraintsWithVisualFormat:@"[cancelButton]-[acceptButton]" options:0 metrics:nil views:viewsDictionary]; UIButton *cancelButton = ... UIButton *acceptButton = ... viewsDictionary = NSDictionaryOfVariableBindings(cancelButton,acceptButton);
  11. 11. DEMO
  12. 12. More Information WWDC 2012 Session 202 Introduction to Auto Layout for iOS and OS X WWDC 2012 Session 232 AutoLayout By Example WWDC 2012 Session 228 Best Practices for Mastering Auto Layout
  13. 13. More Information WWDC 2013 Session 400 What’s new in Xcode 5 WWDC 2013 Session 406 Taking Control of Auto Layout in Xcode 5

×