Daemon
Daemon

Reputation: 439

reloadComponent method in UIPickerView

In the help document, it says that:

Calling this method causes the picker view to query the delegate for new data for the given component.

I added some breakpoints at:

- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView 
- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component
- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component

when I call the reloadComponent method but none of them were called. What is the problem?

Upvotes: 0

Views: 1014

Answers (1)

James Bedford
James Bedford

Reputation: 28962

You need to set the dataSource property of the pickerView to an instance of a class that implements the UIPickerViewDataSource protocol.

I think the documentation is referring to a "delegate" as in the software engineering design pattern of delegation, as opposed to the property delegate of the class which is probably a little misleading.

Upvotes: 2

Related Questions