problem with Delegates..

Discussion in 'iOS Programming' started by bytezone, May 5, 2009.

  1. bytezone macrumors member

    Apr 20, 2009
    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...??

  2. robbieduncan Moderator emeritus


    Jul 24, 2002
    You are confusing two distinct and very different concepts: delegates and protocols. The <UIActionSheetDelegate> says that this class implements the UIActionSheetDelegate protocol.
  3. PhoneyDeveloper macrumors 68040


    Sep 2, 2008
    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.
  4. BlackWolf macrumors regular

    Apr 9, 2009
    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


    to see everything a protocol defines see the reference for that protocol, like
  5. bytezone thread starter macrumors member

    Apr 20, 2009
    Sorry for the should have been protocols.

    I read this

    It was very usefull. Thanks everyone for valuable suggestions.


Share This Page