Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

bytezone

macrumors member
Original poster
Apr 20, 2009
64
0
I am using the Exploring Iphone SDK by Dave and Jeff.

So far I am able to pick up everythin. But yesturday I came across a chapter which uses delegates like this...

interface Control_FunViewController : UIViewController <UIActionSheetDelegate> {
IBOutlet UITextField *nameField;
IBOutlet UITextField *numberField;
IBOutlet UILabel *sliderLabel;
IBOutlet UISwitch *leftSwitch;
IBOutlet UISwitch *rightSwitch;
IBOutlet UIView *switchView;
IBOutlet UIButton *doSomethingButton;


}

Where can read to know more about why <UIActionSheetDelegate> is used. I mean I want to learn more about delegates in cocoa touch frame work. Any good link for this...??

Thanks
 
You are confusing two distinct and very different concepts: delegates and protocols. The <UIActionSheetDelegate> says that this class implements the UIActionSheetDelegate protocol.
 
Delegates and delegations is an important and ubiquitous concept in Cocoa. Look here for some discussion:

Cocoa Fundamentals Guide/Communication With Objects/Delegates and Data Sources.

You should read the whole guide.

I found this as follows: Open the Documentation window in Xcode. Type in 'delegation' to the search bar at the top of the window. Select Apple iPhone OS 2.2 Doc Set. Choose Full-Text search. A lot of choices appear but this is the best one.
 
You are confusing two distinct and very different concepts: delegates and protocols. The <UIActionSheetDelegate> says that this class implements the UIActionSheetDelegate protocol.

yep, that's something completly different. if you want to know about protocols, that is pretty easy. it's just a way to make sure a class implements some methods. in your example, the protocol does not have any necessary methods, but some optional ones like

actionSheet:clickedButtonAtIndex:

to see everything a protocol defines see the reference for that protocol, like
http://developer.apple.com/iphone/l...ctionSheetDelegate/UIActionSheetDelegate.html
 
Sorry for the confusion..it should have been protocols.

I read this
http://developer.apple.com/DOCUMENT...#//apple_ref/doc/uid/TP30001163-CH15-BAJJABHJ

It was very usefull. Thanks everyone for valuable suggestions.


yep, that's something completly different. if you want to know about protocols, that is pretty easy. it's just a way to make sure a class implements some methods. in your example, the protocol does not have any necessary methods, but some optional ones like

actionSheet:clickedButtonAtIndex:

to see everything a protocol defines see the reference for that protocol, like
http://developer.apple.com/iphone/l...ctionSheetDelegate/UIActionSheetDelegate.html
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.