SlideShare una empresa de Scribd logo
1 de 23
Descargar para leer sin conexión
iPhone	
  Development:	
  	
  
      Mul1ple	
  Views	
  
            Jussi	
  Pohjolainen	
  
Tampere	
  University	
  of	
  Applied	
  Sciences	
  
Mul1view	
  App:	
  U1lity	
  Applica1on	
  
•  Primarily	
  one	
  view	
  
•  Second	
  view	
  for	
  seAngs	
  
•  Example:	
  Stock	
  -­‐	
  
   applica1on	
  
Mul1view	
  App:	
  Tab	
  Bar	
  Applica1on	
  
•  Mul1view	
  app	
  that	
  
   displays	
  a	
  row	
  of	
  
   buIons	
  at	
  the	
  boIom	
  
   of	
  the	
  screen.	
  
•  Tapping	
  one	
  of	
  the	
  
   buIons	
  causes	
  new	
  
   view	
  to	
  be	
  ac1ve.	
  
•  Example:	
  Phone-­‐app	
  
Mul1view	
  App:	
  	
  
         Naviga1on-­‐Based	
  Applica1on	
  
•  Hierarchical	
  
   Informa1on	
  to	
  the	
  user	
  
•  Example:	
  Mail-­‐app	
  
Terminology	
  of	
  Views	
  
•  BuIons,	
  Labels	
  and	
  other	
  controls	
  are	
  
   subclasses	
  of	
  UIView
•  View	
  generally	
  refers	
  to	
  subclass	
  of	
  UIView	
  
   that	
  has	
  corresponding	
  view	
  controller	
  
•  Views	
  with	
  view	
  controller	
  are	
  called	
  content	
  
   views.	
  
UIWindow?	
  
•  UIWindow:	
  the	
  path	
  to	
  the	
  user	
  
•  If	
  you	
  want	
  something	
  to	
  be	
  visible	
  for	
  the	
  
   user,	
  you	
  must	
  use	
  the	
  UIWindow!	
  
•  UIView	
  objects	
  are	
  arranged	
  in	
  UIWindow	
  in	
  
   hierarchy.	
  
•  Parent	
  object	
  is	
  called	
  superview	
  
    –  UIWindow	
  
        •  UIView 	
  	
  
            – UIBuIon	
  
UIWindow	
  and	
  UIView	
  
@interface MultiViewExampleAppDelegate : NSObject
  <UIApplicationDelegate> {
    UIWindow *window;
}
...
[window addSubview: someView];
UIView	
  
•  UIView	
  is	
  a	
  base	
  class	
  for	
  or	
  the	
  controls	
  
     –  UIView	
  
          •  UIControl	
  
               –  UIBuIon	
  
•  UIView	
  may	
  be	
  also	
  a	
  content	
  view,	
  or	
  canvas.	
  
•  UIView	
  holds	
  several	
  controls:	
  
     –  [someUIView addSubView: someButton];
•  So	
  basically	
  we	
  could	
  have	
  a	
  UIWindow,	
  that	
  has	
  
   one	
  UIView	
  that	
  contains	
  two	
  UIViews	
  which	
  
   contains	
  several	
  controls	
  
Controlling	
  Different	
  Content	
  Views	
  
•  To	
  control	
  different	
  content	
  views,	
  you	
  must	
  
   have	
  some	
  kind	
  of	
  root	
  controller	
  
   –  UIViewController	
  (U2lity	
  app)	
  
   –  UITabBarController	
  (Tab	
  Bar	
  app)	
  
   –  UINaviga1onController	
  (Naviga1on	
  app)	
  
•  RootController	
  is	
  responsible	
  of	
  switching	
  
   views	
  
•  RootController	
  holds	
  content	
  views	
  
Controller	
  and	
  Content	
  View	
  

                               Content	
  View	
  




      Root	
  Controller	
     Content	
  View	
  




                               Content	
  View	
  
Rela1onship	
  




                                       Gray's	
  view	
  




Root's	
  view	
  
Rela1onship	
  




                                       White's	
  view	
  




Root's	
  view	
  
Tab	
  Bar	
  Applica1on	
  




Root's	
  view	
  
Content	
  View	
  
•  Content	
  View	
  holds	
  controls	
  (widgets)	
  
•  Content	
  View	
  consists	
  of	
  
       1.  View	
  Controller	
  (!)	
  
       2.  The	
  Nib	
  file	
  
	
  
	
  
Controller	
  and	
  Content	
  View	
  
                                         Content	
  View	
  
                           View1Controller.h	
  
                           View1Controller.m	
  
                                                        View1.xib	
  




                                         Content	
  View	
  
  Root	
  Controller	
     View2Controller.h	
  
                           View2Controller.m	
  
                                                        View2.xib	
  



                                         Content	
  View	
  
                           View3Controller.h	
  
                           View3Controller.m	
  
                                                        View3.xib	
  
Hierarchy	
  
                                                                          Interface	
  Builder	
  
UIViewController	
                         UIViewController	
                   (.xib)	
  


                     Content	
  View	
  

                                           View	
  Controller	
     UIView	
                UIBuIon	
  




 Root	
  Controller	
                      View	
  Controller	
     UIView	
                UIBuIon	
  




                                           View	
  Controller	
     UIView	
                UIBuIon	
  
Delegate	
  Class	
  
#import <UIKit/UIKit.h>
#import "SwitchViewController.h"

@interface MyAppDelegate : NSObject <UIApplicationDelegate> {
    UIWindow *window;
    SwitchMyViewController *switchmyviewcontroller;
}

@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet SwitchMyViewController
   *switchmyviewcontroller;

@end
Delegate	
  Class	
  .m	
  
- (BOOL)application:(UIApplication *)application
   didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    // Override point for customization after application launch.
    [window addSubview: switchmyviewcontroller.view];
    [window makeKeyAndVisible];

    return YES;
}
Root	
  Controller	
  
// Promise we will import these classes later
@class GrayViewController;
@class WhiteViewController;

@interface SwitchMyViewController : UIViewController {
    GrayViewController *grayViewController;
    WhiteViewController *whiteViewController;
}

@property (nonatomic, retain) GrayViewController *grayViewController;
@property (nonatomic, retain) WhiteViewController *whiteViewController;

// This method can change views. You can have for example a button
// that changes the content view
- (IBAction) switchViews:(id) sender;

@end
Content	
  View's	
  Controller	
  
#import <UIKit/UIKit.h>


@interface WhiteViewController: UIViewController {

}

// Possible actions and outlets
-(IBAction) grayButtonPressed:(id) sender;


@end
UIViewController	
  -­‐>	
  View?	
  
•  Each	
  View	
  Controller	
  has	
  a	
  View...	
  
    –  ..where	
  all	
  the	
  controls,	
  widgets,	
  are	
  stored	
  
•  The	
  view	
  is	
  usually	
  implemented	
  in	
  Interface	
  
   builder	
  
•  So	
  you	
  should	
  have	
  
    –  MyView1Controller.h
    –  MyView1Controller.m
    –  MyView1.xib
Crea1ng	
  Controllers	
  
Crea1ng	
  .nib	
  files	
  

Más contenido relacionado

Similar a iPhone Development: Multiple Views

아이폰강의(5) pdf
아이폰강의(5) pdf아이폰강의(5) pdf
아이폰강의(5) pdfsunwooindia
 
Intro to UIKit • Made by Many
Intro to UIKit • Made by ManyIntro to UIKit • Made by Many
Intro to UIKit • Made by Manykenatmxm
 
iPhone Programming [7/17] : Behind the Scene
iPhone Programming [7/17] : Behind the SceneiPhone Programming [7/17] : Behind the Scene
iPhone Programming [7/17] : Behind the SceneIMC Institute
 
Session 13 - Working with navigation and tab bar
Session 13 - Working with navigation and tab barSession 13 - Working with navigation and tab bar
Session 13 - Working with navigation and tab barVu Tran Lam
 
Beginning iOS6 Development CH06 Multiview Applications
Beginning iOS6 Development CH06 Multiview ApplicationsBeginning iOS6 Development CH06 Multiview Applications
Beginning iOS6 Development CH06 Multiview ApplicationsAbdulrazzaq Alnajjar
 
iPhone Programming [3/17] : Basic UI
iPhone Programming [3/17] : Basic UIiPhone Programming [3/17] : Basic UI
iPhone Programming [3/17] : Basic UIIMC Institute
 
Android and IOS UI Development (Android 5.0 and iOS 9.0)
Android and IOS UI Development (Android 5.0 and iOS 9.0)Android and IOS UI Development (Android 5.0 and iOS 9.0)
Android and IOS UI Development (Android 5.0 and iOS 9.0)Michael Shrove
 
December 2014 University iOS Meetup Talk
December 2014 University iOS Meetup TalkDecember 2014 University iOS Meetup Talk
December 2014 University iOS Meetup Talkjcgohlke
 
April iOS Meetup - UIAppearance Presentation
April iOS Meetup - UIAppearance PresentationApril iOS Meetup - UIAppearance Presentation
April iOS Meetup - UIAppearance PresentationLong Weekend LLC
 
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 05)
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 05)iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 05)
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 05)Jonathan Engelsma
 
Apple Watch and WatchKit - A Technical Overview
Apple Watch and WatchKit - A Technical OverviewApple Watch and WatchKit - A Technical Overview
Apple Watch and WatchKit - A Technical OverviewSammy Sunny
 

Similar a iPhone Development: Multiple Views (20)

아이폰강의(5) pdf
아이폰강의(5) pdf아이폰강의(5) pdf
아이폰강의(5) pdf
 
iOS: View Controllers
iOS: View ControllersiOS: View Controllers
iOS: View Controllers
 
Intro to UIKit • Made by Many
Intro to UIKit • Made by ManyIntro to UIKit • Made by Many
Intro to UIKit • Made by Many
 
iPhone Programming [7/17] : Behind the Scene
iPhone Programming [7/17] : Behind the SceneiPhone Programming [7/17] : Behind the Scene
iPhone Programming [7/17] : Behind the Scene
 
занятие6
занятие6занятие6
занятие6
 
iOS training (intermediate)
iOS training (intermediate)iOS training (intermediate)
iOS training (intermediate)
 
Session 13 - Working with navigation and tab bar
Session 13 - Working with navigation and tab barSession 13 - Working with navigation and tab bar
Session 13 - Working with navigation and tab bar
 
Objective c design pattens-architetcure
Objective c design pattens-architetcureObjective c design pattens-architetcure
Objective c design pattens-architetcure
 
Introduction of Xcode
Introduction of XcodeIntroduction of Xcode
Introduction of Xcode
 
Beginning iOS6 Development CH06 Multiview Applications
Beginning iOS6 Development CH06 Multiview ApplicationsBeginning iOS6 Development CH06 Multiview Applications
Beginning iOS6 Development CH06 Multiview Applications
 
I os 11
I os 11I os 11
I os 11
 
IOS- Designing with ui tool bar in ios
IOS-  Designing with ui tool bar in iosIOS-  Designing with ui tool bar in ios
IOS- Designing with ui tool bar in ios
 
iPhone Programming [3/17] : Basic UI
iPhone Programming [3/17] : Basic UIiPhone Programming [3/17] : Basic UI
iPhone Programming [3/17] : Basic UI
 
Android and IOS UI Development (Android 5.0 and iOS 9.0)
Android and IOS UI Development (Android 5.0 and iOS 9.0)Android and IOS UI Development (Android 5.0 and iOS 9.0)
Android and IOS UI Development (Android 5.0 and iOS 9.0)
 
December 2014 University iOS Meetup Talk
December 2014 University iOS Meetup TalkDecember 2014 University iOS Meetup Talk
December 2014 University iOS Meetup Talk
 
SwiftでUIKitDynamics
SwiftでUIKitDynamicsSwiftでUIKitDynamics
SwiftでUIKitDynamics
 
IOS APPs Revision
IOS APPs RevisionIOS APPs Revision
IOS APPs Revision
 
April iOS Meetup - UIAppearance Presentation
April iOS Meetup - UIAppearance PresentationApril iOS Meetup - UIAppearance Presentation
April iOS Meetup - UIAppearance Presentation
 
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 05)
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 05)iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 05)
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 05)
 
Apple Watch and WatchKit - A Technical Overview
Apple Watch and WatchKit - A Technical OverviewApple Watch and WatchKit - A Technical Overview
Apple Watch and WatchKit - A Technical Overview
 

Más de Jussi Pohjolainen

libGDX: Screens, Fonts and Preferences
libGDX: Screens, Fonts and PreferenceslibGDX: Screens, Fonts and Preferences
libGDX: Screens, Fonts and PreferencesJussi Pohjolainen
 
libGDX: User Input and Frame by Frame Animation
libGDX: User Input and Frame by Frame AnimationlibGDX: User Input and Frame by Frame Animation
libGDX: User Input and Frame by Frame AnimationJussi Pohjolainen
 
Intro to Building Android Games using libGDX
Intro to Building Android Games using libGDXIntro to Building Android Games using libGDX
Intro to Building Android Games using libGDXJussi Pohjolainen
 
Advanced JavaScript Development
Advanced JavaScript DevelopmentAdvanced JavaScript Development
Advanced JavaScript DevelopmentJussi Pohjolainen
 
libGDX: Simple Frame Animation
libGDX: Simple Frame AnimationlibGDX: Simple Frame Animation
libGDX: Simple Frame AnimationJussi Pohjolainen
 
libGDX: Simple Frame Animation
libGDX: Simple Frame AnimationlibGDX: Simple Frame Animation
libGDX: Simple Frame AnimationJussi Pohjolainen
 
Implementing a Simple Game using libGDX
Implementing a Simple Game using libGDXImplementing a Simple Game using libGDX
Implementing a Simple Game using libGDXJussi Pohjolainen
 
Building Android games using LibGDX
Building Android games using LibGDXBuilding Android games using LibGDX
Building Android games using LibGDXJussi Pohjolainen
 
Creating Asha Games: Game Pausing, Orientation, Sensors and Gestures
Creating Asha Games: Game Pausing, Orientation, Sensors and GesturesCreating Asha Games: Game Pausing, Orientation, Sensors and Gestures
Creating Asha Games: Game Pausing, Orientation, Sensors and GesturesJussi Pohjolainen
 
Creating Games for Asha - platform
Creating Games for Asha - platformCreating Games for Asha - platform
Creating Games for Asha - platformJussi Pohjolainen
 

Más de Jussi Pohjolainen (20)

Moved to Speakerdeck
Moved to SpeakerdeckMoved to Speakerdeck
Moved to Speakerdeck
 
Java Web Services
Java Web ServicesJava Web Services
Java Web Services
 
Box2D and libGDX
Box2D and libGDXBox2D and libGDX
Box2D and libGDX
 
libGDX: Screens, Fonts and Preferences
libGDX: Screens, Fonts and PreferenceslibGDX: Screens, Fonts and Preferences
libGDX: Screens, Fonts and Preferences
 
libGDX: Tiled Maps
libGDX: Tiled MapslibGDX: Tiled Maps
libGDX: Tiled Maps
 
libGDX: User Input and Frame by Frame Animation
libGDX: User Input and Frame by Frame AnimationlibGDX: User Input and Frame by Frame Animation
libGDX: User Input and Frame by Frame Animation
 
Intro to Building Android Games using libGDX
Intro to Building Android Games using libGDXIntro to Building Android Games using libGDX
Intro to Building Android Games using libGDX
 
Advanced JavaScript Development
Advanced JavaScript DevelopmentAdvanced JavaScript Development
Advanced JavaScript Development
 
Introduction to JavaScript
Introduction to JavaScriptIntroduction to JavaScript
Introduction to JavaScript
 
Introduction to AngularJS
Introduction to AngularJSIntroduction to AngularJS
Introduction to AngularJS
 
libGDX: Scene2D
libGDX: Scene2DlibGDX: Scene2D
libGDX: Scene2D
 
libGDX: Simple Frame Animation
libGDX: Simple Frame AnimationlibGDX: Simple Frame Animation
libGDX: Simple Frame Animation
 
libGDX: Simple Frame Animation
libGDX: Simple Frame AnimationlibGDX: Simple Frame Animation
libGDX: Simple Frame Animation
 
libGDX: User Input
libGDX: User InputlibGDX: User Input
libGDX: User Input
 
Implementing a Simple Game using libGDX
Implementing a Simple Game using libGDXImplementing a Simple Game using libGDX
Implementing a Simple Game using libGDX
 
Building Android games using LibGDX
Building Android games using LibGDXBuilding Android games using LibGDX
Building Android games using LibGDX
 
Android Threading
Android ThreadingAndroid Threading
Android Threading
 
Creating Asha Games: Game Pausing, Orientation, Sensors and Gestures
Creating Asha Games: Game Pausing, Orientation, Sensors and GesturesCreating Asha Games: Game Pausing, Orientation, Sensors and Gestures
Creating Asha Games: Game Pausing, Orientation, Sensors and Gestures
 
Creating Games for Asha - platform
Creating Games for Asha - platformCreating Games for Asha - platform
Creating Games for Asha - platform
 
Intro to Asha UI
Intro to Asha UIIntro to Asha UI
Intro to Asha UI
 

Último

Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docxPoojaSen20
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docxPoojaSen20
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Shubhangi Sonawane
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxVishalSingh1417
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin ClassesCeline George
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 

Último (20)

Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 

iPhone Development: Multiple Views

  • 1. iPhone  Development:     Mul1ple  Views   Jussi  Pohjolainen   Tampere  University  of  Applied  Sciences  
  • 2. Mul1view  App:  U1lity  Applica1on   •  Primarily  one  view   •  Second  view  for  seAngs   •  Example:  Stock  -­‐   applica1on  
  • 3. Mul1view  App:  Tab  Bar  Applica1on   •  Mul1view  app  that   displays  a  row  of   buIons  at  the  boIom   of  the  screen.   •  Tapping  one  of  the   buIons  causes  new   view  to  be  ac1ve.   •  Example:  Phone-­‐app  
  • 4. Mul1view  App:     Naviga1on-­‐Based  Applica1on   •  Hierarchical   Informa1on  to  the  user   •  Example:  Mail-­‐app  
  • 5. Terminology  of  Views   •  BuIons,  Labels  and  other  controls  are   subclasses  of  UIView •  View  generally  refers  to  subclass  of  UIView   that  has  corresponding  view  controller   •  Views  with  view  controller  are  called  content   views.  
  • 6. UIWindow?   •  UIWindow:  the  path  to  the  user   •  If  you  want  something  to  be  visible  for  the   user,  you  must  use  the  UIWindow!   •  UIView  objects  are  arranged  in  UIWindow  in   hierarchy.   •  Parent  object  is  called  superview   –  UIWindow   •  UIView     – UIBuIon  
  • 7. UIWindow  and  UIView   @interface MultiViewExampleAppDelegate : NSObject <UIApplicationDelegate> { UIWindow *window; } ... [window addSubview: someView];
  • 8. UIView   •  UIView  is  a  base  class  for  or  the  controls   –  UIView   •  UIControl   –  UIBuIon   •  UIView  may  be  also  a  content  view,  or  canvas.   •  UIView  holds  several  controls:   –  [someUIView addSubView: someButton]; •  So  basically  we  could  have  a  UIWindow,  that  has   one  UIView  that  contains  two  UIViews  which   contains  several  controls  
  • 9. Controlling  Different  Content  Views   •  To  control  different  content  views,  you  must   have  some  kind  of  root  controller   –  UIViewController  (U2lity  app)   –  UITabBarController  (Tab  Bar  app)   –  UINaviga1onController  (Naviga1on  app)   •  RootController  is  responsible  of  switching   views   •  RootController  holds  content  views  
  • 10. Controller  and  Content  View   Content  View   Root  Controller   Content  View   Content  View  
  • 11. Rela1onship   Gray's  view   Root's  view  
  • 12. Rela1onship   White's  view   Root's  view  
  • 13. Tab  Bar  Applica1on   Root's  view  
  • 14. Content  View   •  Content  View  holds  controls  (widgets)   •  Content  View  consists  of   1.  View  Controller  (!)   2.  The  Nib  file      
  • 15. Controller  and  Content  View   Content  View   View1Controller.h   View1Controller.m   View1.xib   Content  View   Root  Controller   View2Controller.h   View2Controller.m   View2.xib   Content  View   View3Controller.h   View3Controller.m   View3.xib  
  • 16. Hierarchy   Interface  Builder   UIViewController   UIViewController   (.xib)   Content  View   View  Controller   UIView   UIBuIon   Root  Controller   View  Controller   UIView   UIBuIon   View  Controller   UIView   UIBuIon  
  • 17. Delegate  Class   #import <UIKit/UIKit.h> #import "SwitchViewController.h" @interface MyAppDelegate : NSObject <UIApplicationDelegate> { UIWindow *window; SwitchMyViewController *switchmyviewcontroller; } @property (nonatomic, retain) IBOutlet UIWindow *window; @property (nonatomic, retain) IBOutlet SwitchMyViewController *switchmyviewcontroller; @end
  • 18. Delegate  Class  .m   - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. [window addSubview: switchmyviewcontroller.view]; [window makeKeyAndVisible]; return YES; }
  • 19. Root  Controller   // Promise we will import these classes later @class GrayViewController; @class WhiteViewController; @interface SwitchMyViewController : UIViewController { GrayViewController *grayViewController; WhiteViewController *whiteViewController; } @property (nonatomic, retain) GrayViewController *grayViewController; @property (nonatomic, retain) WhiteViewController *whiteViewController; // This method can change views. You can have for example a button // that changes the content view - (IBAction) switchViews:(id) sender; @end
  • 20. Content  View's  Controller   #import <UIKit/UIKit.h> @interface WhiteViewController: UIViewController { } // Possible actions and outlets -(IBAction) grayButtonPressed:(id) sender; @end
  • 21. UIViewController  -­‐>  View?   •  Each  View  Controller  has  a  View...   –  ..where  all  the  controls,  widgets,  are  stored   •  The  view  is  usually  implemented  in  Interface   builder   •  So  you  should  have   –  MyView1Controller.h –  MyView1Controller.m –  MyView1.xib