Question about the delegate

Discussion in 'iOS Programming' started by Raima, May 7, 2010.

  1. Raima macrumors 6502

    Joined:
    Jan 21, 2010
    #1
    Hi Guys,

    Just a question about the delegate, or deleagates.

    Is it possible to have more than one delegate, or are you restricted to one?

    Thanks in advance :)
     
  2. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #2
    No, you cannot set more than one delegate on any class I've ever seen. If you want to do this you will have to provide your own class that you set as the delegate which then mediates between all the delegates you wish to set. You will have to thing very carefully about this: if two delegates both implement the same delegate method which do you call?
     
  3. Raima thread starter macrumors 6502

    Joined:
    Jan 21, 2010
    #3
    So does this mean if you have 4 classes, you can potentially have 4 delegates?
     
  4. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #4
    4 instances. Each instance of a class can have a different delegate.
     

Share This Page