picker.delegate = self;

Discussion in 'iPhone/iPad Programming' started by rahul29tech, Feb 18, 2012.

  1. macrumors member

    #1
    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. macrumors demi-god

    ChristianJapan

    #2
    A bit more context possible ? where did you saw that line ?

    Let's assume in this context ...

    https://developer.apple.com/library..._Protocol/Reference/UIPickerViewDelegate.html

    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