picker.delegate = self;

Discussion in 'iOS Programming' started by rahul29tech, Feb 18, 2012.

  1. rahul29tech
    Expand Collapse
    macrumors member

    Dec 22, 2011
    picker.delegate = self;
    plz explain me this line of code,,,,,is it necessary to allocate self to delegate what this code actually doing ,whats its necessity ,,,,
  2. ChristianJapan
    Expand Collapse
    macrumors 68040


    May 10, 2010
    A bit more context possible ? where did you saw that line ?

    Let's assume in this context ...


    The protocol just define the methods and is not a class definition whch can be used to initiate an instance. The protocol need to be referenced and implemented by a delegation class (could be a view controller).

    Set the delegate is required so that the instance which implement the protocol (like "callback" methods) for the picker actually can be addressed.

Share This Page