Utilising View Controllers

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    Favorites, Groups & Events

    Utilising View Controllers - Presentation Transcript

    1. U"lising View Controllers Daniel Tull
    2. A Small Plug... Sky+ Weather Maps
    3. What is a view controller? A class to manage user  interface logic for a view.
    4. What is a view controller? Provides the structure and  functionality of the Apple‐ developed UI design  patterns.
    5. What is a view controller? Navigation Bar Title Navigation  Back Button Bar Button Table View Tab Bar ‘More’ Tab Item
    6. Why use a view controller? Almost zero code to use Tab and Navigation  Bars.  Use to display a modal view (like a login page). Get a message when the orientation of the device  changes so you can handle landscape mode. Memory warnings enable you to avoid crashing  out due to too many views in memory.
    7. Naviga"on Controller Allows navigation  through a hierarchy of  view controllers. You don’t need to write  (much) code for it.
    8. Naviga"on Controller Allows navigation  through a hierarchy of  view controllers.  You don’t need to write  (much) code for them.
    9. Naviga"on Controller [self.navigationController pushViewController:vc  animated:YES]; [self.navigationController  popViewControllerAnimated:YES]; 
    10. Tab Bar Controllers Allow quick switching of  view controllers. You don’t need to write  (much) code for them;  Send it an array of view  controllers and it works!
    11. Tab Bar Controllers Allow quick switching of  view controllers. You don’t need to write  (much) code for them;  Send it an array of view  controllers and it works!
    12. Tab Bar Controllers Allow quick switching of  view controllers. You don’t need to write  (much) code for them;  Send it an array of view  controllers and it works!
    13. Subclassing UIViewController Implement initWithNibName:bundle: if you need to   handle any speciOic logic when creating your view  controller. This Oinds the view XIB of the provided details and  loads it for use. The File Owner of the XIB is the view controller  subclass, so we set that in Interface Builder.
    14. Subclassing UIViewController
    15. Subclassing UIViewController Create an init method, because it’ll make life easier. ‐(id)init {     return [self initWithNibName:@“MyView” bundle:nil]; } But still use the initWithNibName:bundle: method  in your subclass rather than calling super!
    16. A View XIB for view controllers Connecting the view controller’s view property to  the UIView in Interface Builder.
    17. A View XIB for view controllers Setting the view’s  autosizing property to  Olexible width and height  will allow use inside any  view controller structure. 
    18. Autorota"on If you have set the view to Olexible width and  height, it will resize to the new dimensions. ‐ (BOOL)shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation)interfaceOrientation {     return YES; } Giving subviews correct autoresizingMask  properties will allow you to go landscape  automatically.
    19. Autorota"on
    20. Autorota"on
    21. Autorota"on
    22. Autorota"on
    23. Autorota"on
    24. Autorota"on
    25. Autorota"on
    26. Autorota"on
    27. Crea"ng IBOutlets The nib loading mechanism uses accessors, so you  should declare outlets in property delcarations: @interface MyViewController : UIViewController {     UIView *subView; } @property (nonatomic, retain) IBOutlet UIView *aSubview; @end
    28. Handling Memory Warnings UIViewController didRecieveMemoryWarning view
    29. Handling Memory Warnings UIViewController didRecieveMemoryWarning setView: nil setView: view
    30. Handling Memory Warnings UIViewController didRecieveMemoryWarning setView: nil setView: view
    31. Handling Memory Warnings MyViewController view UIView *aSubview;  UIImage *image1;  UIBuQon *buQon1; UILabel *label1;  UIView *subview;  UIImage *image2;  UIBuQon *buQon2; UILabel *label2;  DTGridView *grid;  UIImage *image3;  UIImage *buQon3;  UILabel *label3;  UITableView *table;  UISlider *slider; UIWebView *webView;  UISegmentedControl *segControl;
    32. Handling Memory Warnings MyViewController didRecieveMemoryWarning view UIView *aSubview;  UIImage *image1;  UIBuQon *buQon1; UILabel *label1;  UIView *subview;  UIImage *image2;  UIBuQon *buQon2; UILabel *label2;  DTGridView *grid;  UIImage *image3;  UIImage *buQon3;  UILabel *label3;  UITableView *table;  UISlider *slider; UIWebView *webView;  UISegmentedControl *segControl;
    33. Handling Memory Warnings MyViewController didRecieveMemoryWarning setView: nil setView: view UIView *aSubview;  UIImage *image1;  UIBuQon *buQon1; UILabel *label1;  UIView *subview;  UIImage *image2;  UIBuQon *buQon2; UILabel *label2;  DTGridView *grid;  UIImage *image3;  UIImage *buQon3;  UILabel *label3;  UITableView *table;  UISlider *slider; UIWebView *webView;  UISegmentedControl *segControl;
    34. Handling Memory Warnings MyViewController didRecieveMemoryWarning setView: nil setView: view UIView *aSubview;  UIImage *image1;  UIBuQon *buQon1; UILabel *label1;  UIView *subview;  UIImage *image2;  UIBuQon *buQon2; UILabel *label2;  DTGridView *grid;  UIImage *image3;  UIImage *buQon3;  UILabel *label3;  UITableView *table;  UISlider *slider; UIWebView *webView;  UISegmentedControl *segControl;
    35. Handling Memory Warnings ‐ (void)setView:(UIView *)aView {     if (!aView)         self.someSubview = nil;          [super setView:aView]; } ‐ (void)dealloc {     [someSubview release];     someSubview = nil; }
    36. Thank You dt@danieltull.co.uk
    SlideShare Zeitgeist 2009

    + danielctulldanielctull Nominate

    custom

    379 views, 0 favs, 0 embeds more stats

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 379
      • 379 on SlideShare
      • 0 from embeds
    • Comments 0
    • Favorites 0
    • Downloads 2
    Most viewed embeds

    more

    All embeds

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories