iOS UIStoryboard presentation

1,771 views

Published on

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

No Downloads
Views
Total views
1,771
On SlideShare
0
From Embeds
0
Number of Embeds
88
Actions
Shares
0
Downloads
28
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

iOS UIStoryboard presentation

  1. 1. EXPERIENCES WITH STORYBOARDS Gerald Kim - iOS Developer at jTribe @gerald_kim onTwitter Monday, 22 July 13
  2. 2. - UIStoryboard introduced in iOS 5.0.An Interface Builder tool that encapsulates a viewcontroller graph - Storyboards are an easy way to create a project quickly - Nice way to see an entire project and how it's connected Monday, 22 July 13 - UIStoryboard introduction. Still uses nibs when compiling - Can kind of use for wireframing. Rapidly make an app without code Improving: Unwind segues in iOS 6
  3. 3. BASICS OF STORYBOARDS • Storyboards are another tool to use. Code generated views and IB nibs can still fit in this toolbox as well • Storyboard scenes are concerned with UIViewControllers • Transitions between scenes dictated with UIStoryboardSegue Monday, 22 July 13 Another tool. Can use blank viewcontrollers as container to represent a code or IB generated view. UIViewControllers only.
  4. 4. STORYBOARD SEGUES • Built-in segues for the basic transitions: navigation push, modal, embed, pop-over (iPad only) • Custom segues allow you to customize the transition, from animations to viewcontroller management Monday, 22 July 13 Custom segues. Works with custom nav like popovers and hamburger slide menus like IIViewDeck. Personally found nothing custom segues couldn’t handle
  5. 5. STORYBOARD LIFECYCLE • UIStoryboard will call initWithCoder: for you • prepareForSegue: is called on source controller • Storyboard loads its assets • viewDidLoad: and the rest of the view methods are called Monday, 22 July 13 - No more initWithFrame. Can't depend on designated initializers - Gives you a chance to respond to segue and pass information. [SHOW DEMO] of creating a segue and custom segue code, of prepareForSegue
  6. 6. STORYBOARDS AND COLLECTIONVIEWS • Prototype cells can make layout easy • Static cells great for menus • Not as useful for reusable cells, especially with the new  registerNib:forCellReuseIdentifier: and registerClass:forCellReuseIdentifier: Monday, 22 July 13 - Prototype cells easy. Easier than before. Static tableviews [DEMO] - Not useful reuseable cells. Sharing cells between tableviews. Preferable to use nibs and code unless you want to copy/paste
  7. 7. STORYBOARDS AND CLUTTER • Limit to how many scenes you can fit in a storyboard (I noticed sluggishness at around 30-40) • Merge nightmare in a development team • Copy/paste viewcontroller layouts for reuseable viewcontrollers Monday, 22 July 13 Limit how many viewcontrollers Merge nightmare. Storyboards are still an ugly XML file Copy/paste. eg Login or Gallery view that you want to show in multiple places. NEXT
  8. 8. STORYBOARD LINKING • Can link Storyboards programmatically. + (UIStoryboard *)storyboardWithName:bundle: - (id)instantiateInitialViewController • RBStoryboardLink https://github.com/rob-brown/RBStoryboardLink Monday, 22 July 13 RBStoryboardLink. 3rd party library uses ViewController containment. Seperate storyboards into modules based on functionality. OK for some storyboards to contain 1 viewcontroller.
  9. 9. RBSTORYBOARDLINK • RBStoryboardLink is a great way to visually see links • Can continue to use segues during ‘links’ • Need to be careful of containment and new lifecycle Monday, 22 July 13 Continue to use segues during links, looks nicer, more connected Careful containment. Especially prepareForSegue, viewDidLoad in new controller [SHOW DEMO] Storyboard link, prepareForSegue to linked controller
  10. 10. WHEN NOTTO USE STORYBOARDS • Custom views that don’t initially belong in the viewcontroller (keyboard accessory views) • Reuseable views (UITableViewCells in multiple tableviews) • Highly dynamic views Monday, 22 July 13 Custom views. Keyboard accessory views, tableview headers Reuseable views. Between viewcontrollers: Cells, etc Highly animated views. Need to add views dynamically
  11. 11. SHOULD I CONVERTTO STORYBOARDS? • As always, it depends on your situation • Easy Autolayout in XCode 5 • Need to convert app flow to prepareForSegue: • UIAppearance proxies • Definitely recommend new projects use UIStoryboard Monday, 22 July 13 UIAppearance proxies: Apple swizzles init in views to implement appearance, overwriting any IB change. Will need to apply styles in viewDidLoad:
  12. 12. Questions? • WWDC 2012 Session 407 - Adopting Storyboards into your App • WWDC 2013 Session 405 - Interface Builder Core Concepts REFERENCES Monday, 22 July 13

×