Beginning iOS6 Development CH06 Multiview Applications

1,166 views

Published on

Beginning iOS6 Development CH06 Multiview Applications

Published in: Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,166
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
12
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Beginning iOS6 Development CH06 Multiview Applications

  1. 1. Multiview ApplicationsMobile Applications iabdulrazzaq@outlook.com 1
  2. 2. Types of Multiview Apps• Utility Applications• Tab bar applications• Navigation-based applications• Toolbar applicationsMobile Applications iabdulrazzaq@outlook.com 2
  3. 3. Utility Applications• A utility application focuses primarily on a single view but offers a second view that can be used to configure the application or to provide more detail than the primary view −The Stocks application that ships with iPhone has two views: one to display the data and another to configure the stock listMobile Applications iabdulrazzaq@outlook.com 3
  4. 4. Tab bar applications• A tab bar application is a multiview application that displays a row of buttons, called the tab bar, at the bottom of the screen. Tapping one of the buttons causes a new view controller to become active and a new view to be shown. such as The Phone applicationMobile Applications iabdulrazzaq@outlook.com 4
  5. 5. Navigation-based applications• The navigation-based application features a navigation controller that uses a navigation bar to control a hierarchical series of views. – The navigation controller keeps track of how deep you go and gives you a control to let you make your way back to the previous view.Mobile Applications iabdulrazzaq@outlook.com 5
  6. 6. Toolbar applications• Some applications make use of a toolbar.• Tab bar vs. Toolbar – A tab bar is used for selecting one and only one option from among two or more. – A toolbar can hold buttons and certain other controls, but those items are not mutually exclusive.Mobile Applications iabdulrazzaq@outlook.com 6
  7. 7. The Architecture of a Multiview Application • S Mobile Applications iabdulrazzaq@outlook.com 7
  8. 8. The Root Controller• The root controller is the primary view controller for the application.• It is the first controller the user sees and the controller that is loaded when the application loads.Mobile Applications iabdulrazzaq@outlook.com 8
  9. 9. Anatomy of a Content View• Each content view generally consists of up to three pieces:• The view controller.• The nib.• Subclass of UIView.Mobile Applications iabdulrazzaq@outlook.com 9
  10. 10. UINavigationController• Create a new project using the Empty Application project templateMobile Applications iabdulrazzaq@outlook.com 10
  11. 11. Creating View Controller and Nib Files• Create a new Objective-C Class BIDSwitchViewController. – File ➤ New ➤ File, select Cocoa Touch from the left pane, select Objective-C Class.• 2 more and name them BIDBlueViewController & BIDYellowViewController.• Create a nib file for each of the content views. – File ➤ New ➤ File, select User Interface from the left pane, select View.(SwitchView.xib, BlueView.xib YellowView.xib)Mobile Applications iabdulrazzaq@outlook.com 11
  12. 12. Modifying the App Delegate• In BIDAppDelegate.h:• In BIDAppDelegate.m:Mobile Applications iabdulrazzaq@outlook.com 12
  13. 13. Modifying the App DelegateMobile Applications iabdulrazzaq@outlook.com 13
  14. 14. Modifying BIDSwitchViewController.hMobile Applications iabdulrazzaq@outlook.com 14
  15. 15. Adding a View Controller• Change File’s Owner Class field from NSObject to BIDSwitchViewController. – SwitchView.xibMobile Applications iabdulrazzaq@outlook.com 15
  16. 16. Building a View with a Toolbar• Drag a toolbar onto the view, rename its button title to Switch Views.• control-drag from it over to the File’s Owner icon and select the switchViews: action. – make sure you have the button rather than the toolbar selected.Mobile Applications iabdulrazzaq@outlook.com 16
  17. 17. Writing the Root View Controller• In BIDSwitchViewController.m:(Top)• In viewDidLoad:Mobile Applications iabdulrazzaq@outlook.com 17
  18. 18. Writing the Root View Controller• in the switchViews: method:Mobile Applications iabdulrazzaq@outlook.com 18
  19. 19. Writing the Root View Controller• In didReceiveMemoryWarning method:Mobile Applications iabdulrazzaq@outlook.com 19
  20. 20. Implementing the Content Views• in BIDBlueViewController.h:• In BIDYellowViewController.h:Mobile Applications iabdulrazzaq@outlook.com 20
  21. 21. Implementing the Content Views• Change File’s Owner Class field from NSObject to BIDBlueViewController for BlueView.xib & to BIDYellowViewController for YellowView.xib.• Then change the background color of both views to blue & yellow.Mobile Applications iabdulrazzaq@outlook.com 21
  22. 22. Implementing the Content Views• Then change the size of the view in the nibMobile Applications iabdulrazzaq@outlook.com 22
  23. 23. Implementing the Content Views• Then Drag a Round Rect Button to BlueView.xib (Press Me) drag from the Touch Up Inside event to the File’s Owner icon, and connect to the blueButtonPressed action method.• Control-drag from the File’s Owner icon to the View icon, and select the view outlet. – Do the same with YellowView.xib with changing names.Mobile Applications iabdulrazzaq@outlook.com 23
  24. 24. Implementing the Content Views• In BIDBlueViewController.m:Mobile Applications iabdulrazzaq@outlook.com 24
  25. 25. Implementing the Content Views• In BIDYellowViewController.m:Mobile Applications iabdulrazzaq@outlook.com 25
  26. 26. Animating the Transition• In BIDSwitchViewController.m:Mobile Applications iabdulrazzaq@outlook.com 26
  27. 27. Animating the TransitionMobile Applications iabdulrazzaq@outlook.com 27
  28. 28. Animating the Transition• Some iOS view transitions: – UIViewAnimationTransitionFlipFromLeft – UIViewAnimationTransitionFlipFromRight – UIViewAnimationTransitionCurlUp – UIViewAnimationTransitionCurlDownMobile Applications iabdulrazzaq@outlook.com 28

×