Initialize, set proxy
Uipickerview *picker == self;picker. delegate = self;
@protocolUipickerviewdatasource, uipickerviewdelegate;////Ns_class_available_ios (2_0) __tvos_prohibited @interface Uipickerview:uiview <nscoding, Uitableviewdatasource>//@property (Nullable,nonatomic,weak)ID<UIPickerViewDataSource> DataSource;//default is nil. Weak reference@property (Nullable,nonatomic,weak)ID<UIPickerViewDelegate>Delegate;//default is nil. Weak reference//invalid setting after iOS7@property (nonatomic) BOOL showsselectionindicator;//default is NO//////info that is fetched and cached from the data source and delegate//get total number of components (columns)@property (Nonatomic,ReadOnly) Nsinteger numberofcomponents;//How many rows are in a component-(Nsinteger) Numberofrowsincomponent: (Nsinteger) component;//get the dimensions of a partition row-(cgsize) Rowsizeforcomponent: (Nsinteger) component;//////Returns the view provided by the delegate via PickerView:viewForRow:forComponent:reusingView:////or Nil if the row/component is isn't visible or the delegate does not implement////PickerView:viewForRow:forComponent:reusingView://get a view of a row in a partition-(Nullable UIView *) Viewforrow: (Nsinteger) Row forcomponent: (Nsinteger) component;//////Reloading whole view or single component//Reload All Partitions- (void) reloadallcomponents;//overloading a partition- (void) Reloadcomponent: (Nsinteger) component;//////Selection. In this case, it means showing the appropriate row in the middle//set a row to select a partition- (void) SelectRow: (Nsinteger) Row incomponent: (Nsinteger) component animated: (BOOL) animated;//scrolls the specified row to center.////returns a selected row of a partition-(Nsinteger) Selectedrowincomponent: (Nsinteger) component;//returns selected row.-1 If nothing selected// @end//////__tvos_prohibited @protocolUipickerviewdatasource<nsobject>@required//////Returns the number of ' columns ' to display.set Number of partitions-(Nsinteger) Numberofcomponentsinpickerview: (Uipickerview *) Pickerview;//////Returns the # of rows in each component.set the number of rows by partition-(Nsinteger) Pickerview: (Uipickerview *) Pickerview numberofrowsincomponent: (nsinteger) component; @end////__tvos_prohibited @protocolUipickerviewdelegate<nsobject>@optional//////returns width of column and height of row for each component.-(CGFloat) Pickerview: (Uipickerview *) Pickerview widthforcomponent: (nsinteger) component __tvos_prohibited; -(CGFloat) Pickerview: (Uipickerview *) Pickerview rowheightforcomponent: (nsinteger) component __tvos_prohibited;//////These methods return either a plain nsstring, a nsattributedstring, or a view (e.g UILabel) to display the row for T He component.////For the view versions, we caches any hidden and thus unused views and passes them back for reuse.////If You return a different object and the old one would be released. The view would be centered in the row rectset the caption displayed for a row-(Nullable NSString *) Pickerview: (Uipickerview *) Pickerview Titleforrow: (nsinteger) Row forcomponent: (nsinteger) component __tvos_prohibited; -(Nullable nsattributedstring *) Pickerview: (Uipickerview *) Pickerview Attributedtitleforrow: (nsinteger) row Forcomponent: (Nsinteger) component Ns_available_ios (6_0) __tvos_prohibited;//attributed title is favored if both methods be implementedSet the view view displayed for a row-(UIView *) Pickerview: (Uipickerview *) Pickerview Viewforrow: (nsinteger) Row forcomponent: (Nsinteger) component Reusingview: (Nullable UIView *) view __tvos_prohibited;//callback that is executed when a row is selected- (void) Pickerview: (Uipickerview *) Pickerview Didselectrow: (nsinteger) Row incomponent: (nsinteger) component __tvos_prohibited;// @end
12th Article-Uipickerview