Andrei
Andrei

Reputation: 1005

How to get a function called when picker view list updates?

I've got a pickerview.
I would like to call a specific function each time the list changes (an item is added or removed).
How would I be able to do that ? I have tried a few IB Actions but could not get the function triggered.


Extra:

Here is a little bit more about the project just in case you have a better idea:

I have a ViewController, which has a picker view.
I have a View, that on click of a button, calls a class DataHolder, which ads an item to a dictionary.
This dictionary is linked to the picker view, the picker view updates.

Upvotes: 0

Views: 179

Answers (2)

Ankit Srivastava
Ankit Srivastava

Reputation: 12405

I think you are looking for [pickerView reloadAllComponents];

this will reload all the components of the picker view

Upvotes: 2

Eric
Eric

Reputation: 4061

use

-(void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
{
some method;
}

Upvotes: 1

Related Questions