SlideShare ist ein Scribd-Unternehmen logo
1 von 10
Delegation
 Object Messaging
What is Delegation?
Delegation is a design pattern in object-oriented
programming where an object, instead of
performing one of its stated tasks, delegates that
task to an associated helper object. It passes the
buck, so to speak (technically, an Inversion of
Responsibility).
The helper object is called the delegate. (source:
Wikepedia)
Examples: AppDelegate
• UIApplicationDelegate
 - (BOOL)application:(UIApplication
     *)application
     didFinishLaunchingWithOptions:
     (NSDictionary *)launchOptions
 -   (void)applicationWillTerminate:
     (UIApplication *)application
Examples: UITableView
• UITableViewDelegate
 - UITableViewCell *)tableView:
     (UITableView *)tableView
     cellForRowAtIndexPath:(NSIndexPath
     *)indexPath
 -   ...tableView:didDeselectRowAtIndexPath:
What Problem Does
 Delegation Solve?

  Object A   Object B
Write to File


          Object A                     Object B
        (Equipment)                 (User Interface)



                      somefile.txt
Define Pointers



            Object A                     Object B
          (Equipment)                 (User Interface)




ObjectB *myObject;
myObject = [self getSomeData:data];
App
                            Delegate
                                            Define Property




            Object A                          Object B
          (Equipment)                      (User Interface)




AppDelegate *d = [[UIApplication sharedApplication] delegate];
d.someString = ...
App
                      Delegate
                                  Define Delegate




          Object A                  Object B
        (Equipment)              (User Interface)


• Create Delegate Object • Helper App
• Defines Protocols       • Delegate of Object A
  - List of methods      • Implements Protocol
Demo


• Build a Program using Delegation

Weitere ähnliche Inhalte

Andere mochten auch

Image Digitization with Scanning Technology
Image Digitization with Scanning TechnologyImage Digitization with Scanning Technology
Image Digitization with Scanning TechnologyRachabodin Suwannakanthi
 
VietRees_Newsletter_56_Tuan1_Thang11
VietRees_Newsletter_56_Tuan1_Thang11VietRees_Newsletter_56_Tuan1_Thang11
VietRees_Newsletter_56_Tuan1_Thang11internationalvr
 
1 plan financiero proyecto emprendedor (1)
1 plan financiero proyecto emprendedor (1)1 plan financiero proyecto emprendedor (1)
1 plan financiero proyecto emprendedor (1)mariogomezprieto
 
Curiculum Mod Presentation
Curiculum Mod PresentationCuriculum Mod Presentation
Curiculum Mod PresentationSteve Kashdan
 
VietRees_Newsletter_38_Week1_Month07_Year08
VietRees_Newsletter_38_Week1_Month07_Year08VietRees_Newsletter_38_Week1_Month07_Year08
VietRees_Newsletter_38_Week1_Month07_Year08internationalvr
 
Invitation Autumn
Invitation AutumnInvitation Autumn
Invitation Autumnguestbf0dbb
 
Your First Home By The Book Seminar Us Jim Gatos
Your First Home By The Book Seminar Us Jim GatosYour First Home By The Book Seminar Us Jim Gatos
Your First Home By The Book Seminar Us Jim GatosJim Gatos
 
VietnamRealEstate_E-Directory_VN_Q3_2008
VietnamRealEstate_E-Directory_VN_Q3_2008VietnamRealEstate_E-Directory_VN_Q3_2008
VietnamRealEstate_E-Directory_VN_Q3_2008internationalvr
 
Protokol IPv6
Protokol IPv6Protokol IPv6
Protokol IPv6idnats
 
United Nations Tom Nies Keynote
United Nations Tom Nies KeynoteUnited Nations Tom Nies Keynote
United Nations Tom Nies KeynoteDale Wolf
 
VietRees_Newsletter_34_Tuan1_Thang06
VietRees_Newsletter_34_Tuan1_Thang06VietRees_Newsletter_34_Tuan1_Thang06
VietRees_Newsletter_34_Tuan1_Thang06internationalvr
 
Virunga Mountain Gorillas
Virunga Mountain GorillasVirunga Mountain Gorillas
Virunga Mountain GorillasLiz Weaver
 
Maalem Imen Kairouan01
Maalem Imen Kairouan01Maalem Imen Kairouan01
Maalem Imen Kairouan01guest2c3715
 
Baking day pre nursery 2012
Baking day pre nursery 2012Baking day pre nursery 2012
Baking day pre nursery 2012mariogomezprieto
 

Andere mochten auch (20)

Personal Digital Archives Development
Personal Digital Archives DevelopmentPersonal Digital Archives Development
Personal Digital Archives Development
 
Image Digitization with Scanning Technology
Image Digitization with Scanning TechnologyImage Digitization with Scanning Technology
Image Digitization with Scanning Technology
 
VietRees_Newsletter_56_Tuan1_Thang11
VietRees_Newsletter_56_Tuan1_Thang11VietRees_Newsletter_56_Tuan1_Thang11
VietRees_Newsletter_56_Tuan1_Thang11
 
Perl basics for Pentesters
Perl basics for PentestersPerl basics for Pentesters
Perl basics for Pentesters
 
1 plan financiero proyecto emprendedor (1)
1 plan financiero proyecto emprendedor (1)1 plan financiero proyecto emprendedor (1)
1 plan financiero proyecto emprendedor (1)
 
Pantone fcr-sp2010f
Pantone fcr-sp2010fPantone fcr-sp2010f
Pantone fcr-sp2010f
 
Blue Eye
Blue EyeBlue Eye
Blue Eye
 
Curiculum Mod Presentation
Curiculum Mod PresentationCuriculum Mod Presentation
Curiculum Mod Presentation
 
How’S Your Memory
How’S Your MemoryHow’S Your Memory
How’S Your Memory
 
VietRees_Newsletter_38_Week1_Month07_Year08
VietRees_Newsletter_38_Week1_Month07_Year08VietRees_Newsletter_38_Week1_Month07_Year08
VietRees_Newsletter_38_Week1_Month07_Year08
 
Invitation Autumn
Invitation AutumnInvitation Autumn
Invitation Autumn
 
Your First Home By The Book Seminar Us Jim Gatos
Your First Home By The Book Seminar Us Jim GatosYour First Home By The Book Seminar Us Jim Gatos
Your First Home By The Book Seminar Us Jim Gatos
 
VietnamRealEstate_E-Directory_VN_Q3_2008
VietnamRealEstate_E-Directory_VN_Q3_2008VietnamRealEstate_E-Directory_VN_Q3_2008
VietnamRealEstate_E-Directory_VN_Q3_2008
 
Protokol IPv6
Protokol IPv6Protokol IPv6
Protokol IPv6
 
United Nations Tom Nies Keynote
United Nations Tom Nies KeynoteUnited Nations Tom Nies Keynote
United Nations Tom Nies Keynote
 
VietRees_Newsletter_34_Tuan1_Thang06
VietRees_Newsletter_34_Tuan1_Thang06VietRees_Newsletter_34_Tuan1_Thang06
VietRees_Newsletter_34_Tuan1_Thang06
 
Virunga Mountain Gorillas
Virunga Mountain GorillasVirunga Mountain Gorillas
Virunga Mountain Gorillas
 
Maalem Imen Kairouan01
Maalem Imen Kairouan01Maalem Imen Kairouan01
Maalem Imen Kairouan01
 
Baking day pre nursery 2012
Baking day pre nursery 2012Baking day pre nursery 2012
Baking day pre nursery 2012
 
Lechuzas
LechuzasLechuzas
Lechuzas
 

Ähnlich wie Delegation

Debot android debugging library
Debot android debugging libraryDebot android debugging library
Debot android debugging libraryTomoaki Imai
 
Distributing information on iOS
Distributing information on iOSDistributing information on iOS
Distributing information on iOSMake School
 
Ios development 2
Ios development 2Ios development 2
Ios development 2elnaqah
 
Azure functions
Azure functionsAzure functions
Azure functions명신 김
 
KOIN for dependency Injection
KOIN for dependency InjectionKOIN for dependency Injection
KOIN for dependency InjectionKirill Rozov
 
Implementing Data Visualization Apps on iOS Devices
Implementing Data Visualization Apps on iOS DevicesImplementing Data Visualization Apps on iOS Devices
Implementing Data Visualization Apps on iOS DevicesDouglass Turner
 
New to native? Getting Started With iOS Development
New to native?   Getting Started With iOS DevelopmentNew to native?   Getting Started With iOS Development
New to native? Getting Started With iOS DevelopmentGeoffrey Goetz
 
Mobile Application Development with JUCE and Native API’s
Mobile Application Development with JUCE and Native API’sMobile Application Development with JUCE and Native API’s
Mobile Application Development with JUCE and Native API’sAdam Wilson
 
iOS Beginners Lesson 2
iOS Beginners Lesson 2iOS Beginners Lesson 2
iOS Beginners Lesson 2Calvin Cheng
 
Converting Your Mobile App to the Mobile Cloud
Converting Your Mobile App to the Mobile CloudConverting Your Mobile App to the Mobile Cloud
Converting Your Mobile App to the Mobile CloudRoger Brinkley
 
Android architecture
Android architecture Android architecture
Android architecture Trong-An Bui
 
Code camp 2011 Getting Started with IOS, Una Daly
Code camp 2011 Getting Started with IOS, Una DalyCode camp 2011 Getting Started with IOS, Una Daly
Code camp 2011 Getting Started with IOS, Una DalyUna Daly
 
Day 3: Getting Active Through Activities
Day 3: Getting Active Through ActivitiesDay 3: Getting Active Through Activities
Day 3: Getting Active Through ActivitiesAhsanul Karim
 
Day 3: Getting Active Through Activities
Day 3: Getting Active Through ActivitiesDay 3: Getting Active Through Activities
Day 3: Getting Active Through ActivitiesAhsanul Karim
 
GDG GeorgeTown Devfest 2014 Presentation: Android Wear: A Developer's Perspec...
GDG GeorgeTown Devfest 2014 Presentation: Android Wear: A Developer's Perspec...GDG GeorgeTown Devfest 2014 Presentation: Android Wear: A Developer's Perspec...
GDG GeorgeTown Devfest 2014 Presentation: Android Wear: A Developer's Perspec...mharkus
 
 +  = ❤️ (Firebase for Apple Developers) at Swift Leeds
 +  = ❤️ (Firebase for Apple Developers) at Swift Leeds +  = ❤️ (Firebase for Apple Developers) at Swift Leeds
 +  = ❤️ (Firebase for Apple Developers) at Swift LeedsPeter Friese
 
Mobile Developers Talks: Delve Mobile
Mobile Developers Talks: Delve MobileMobile Developers Talks: Delve Mobile
Mobile Developers Talks: Delve MobileKonstantin Loginov
 

Ähnlich wie Delegation (20)

Debot android debugging library
Debot android debugging libraryDebot android debugging library
Debot android debugging library
 
Distributing information on iOS
Distributing information on iOSDistributing information on iOS
Distributing information on iOS
 
Ios development 2
Ios development 2Ios development 2
Ios development 2
 
Azure functions
Azure functionsAzure functions
Azure functions
 
KOIN for dependency Injection
KOIN for dependency InjectionKOIN for dependency Injection
KOIN for dependency Injection
 
Hello world ios v1
Hello world ios v1Hello world ios v1
Hello world ios v1
 
Implementing Data Visualization Apps on iOS Devices
Implementing Data Visualization Apps on iOS DevicesImplementing Data Visualization Apps on iOS Devices
Implementing Data Visualization Apps on iOS Devices
 
New to native? Getting Started With iOS Development
New to native?   Getting Started With iOS DevelopmentNew to native?   Getting Started With iOS Development
New to native? Getting Started With iOS Development
 
Mobile Application Development with JUCE and Native API’s
Mobile Application Development with JUCE and Native API’sMobile Application Development with JUCE and Native API’s
Mobile Application Development with JUCE and Native API’s
 
iOS Beginners Lesson 2
iOS Beginners Lesson 2iOS Beginners Lesson 2
iOS Beginners Lesson 2
 
Introduction of Xcode
Introduction of XcodeIntroduction of Xcode
Introduction of Xcode
 
Converting Your Mobile App to the Mobile Cloud
Converting Your Mobile App to the Mobile CloudConverting Your Mobile App to the Mobile Cloud
Converting Your Mobile App to the Mobile Cloud
 
Android architecture
Android architecture Android architecture
Android architecture
 
Code camp 2011 Getting Started with IOS, Una Daly
Code camp 2011 Getting Started with IOS, Una DalyCode camp 2011 Getting Started with IOS, Una Daly
Code camp 2011 Getting Started with IOS, Una Daly
 
Day 3: Getting Active Through Activities
Day 3: Getting Active Through ActivitiesDay 3: Getting Active Through Activities
Day 3: Getting Active Through Activities
 
Day 3: Getting Active Through Activities
Day 3: Getting Active Through ActivitiesDay 3: Getting Active Through Activities
Day 3: Getting Active Through Activities
 
GDG GeorgeTown Devfest 2014 Presentation: Android Wear: A Developer's Perspec...
GDG GeorgeTown Devfest 2014 Presentation: Android Wear: A Developer's Perspec...GDG GeorgeTown Devfest 2014 Presentation: Android Wear: A Developer's Perspec...
GDG GeorgeTown Devfest 2014 Presentation: Android Wear: A Developer's Perspec...
 
 +  = ❤️ (Firebase for Apple Developers) at Swift Leeds
 +  = ❤️ (Firebase for Apple Developers) at Swift Leeds +  = ❤️ (Firebase for Apple Developers) at Swift Leeds
 +  = ❤️ (Firebase for Apple Developers) at Swift Leeds
 
iOS
iOSiOS
iOS
 
Mobile Developers Talks: Delve Mobile
Mobile Developers Talks: Delve MobileMobile Developers Talks: Delve Mobile
Mobile Developers Talks: Delve Mobile
 

Kürzlich hochgeladen

Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 

Kürzlich hochgeladen (20)

Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 

Delegation

  • 2. What is Delegation? Delegation is a design pattern in object-oriented programming where an object, instead of performing one of its stated tasks, delegates that task to an associated helper object. It passes the buck, so to speak (technically, an Inversion of Responsibility). The helper object is called the delegate. (source: Wikepedia)
  • 3. Examples: AppDelegate • UIApplicationDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions: (NSDictionary *)launchOptions - (void)applicationWillTerminate: (UIApplication *)application
  • 4. Examples: UITableView • UITableViewDelegate - UITableViewCell *)tableView: (UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath - ...tableView:didDeselectRowAtIndexPath:
  • 5. What Problem Does Delegation Solve? Object A Object B
  • 6. Write to File Object A Object B (Equipment) (User Interface) somefile.txt
  • 7. Define Pointers Object A Object B (Equipment) (User Interface) ObjectB *myObject; myObject = [self getSomeData:data];
  • 8. App Delegate Define Property Object A Object B (Equipment) (User Interface) AppDelegate *d = [[UIApplication sharedApplication] delegate]; d.someString = ...
  • 9. App Delegate Define Delegate Object A Object B (Equipment) (User Interface) • Create Delegate Object • Helper App • Defines Protocols • Delegate of Object A - List of methods • Implements Protocol
  • 10. Demo • Build a Program using Delegation

Hinweis der Redaktion

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n