Your SlideShare is downloading. ×
Delegation
Delegation
Delegation
Delegation
Delegation
Delegation
Delegation
Delegation
Delegation
Delegation
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Delegation

583

Published on

A presentation given at MobileDevNJ about Delegation patterns on the iOS platform.

A presentation given at MobileDevNJ about Delegation patterns on the iOS platform.

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

  • Be the first to like this

No Downloads
Views
Total Views
583
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
53
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Transcript

    • 1. Delegation Object Messaging
    • 2. What is Delegation?Delegation is a design pattern in object-orientedprogramming where an object, instead ofperforming one of its stated tasks, delegates thattask to an associated helper object. It passes thebuck, so to speak (technically, an Inversion ofResponsibility).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

    ×