Kex
Kex

Reputation: 776

Reload content inside a UIPickerView

I'm trying to change the content & reload the UIPickerView when the user clicks on a button.

When the button gets pressed I call [pickerView reloadAllComponents]

The content changes on scrolling when new rows are drawn but the number of rows keeps the same i.e. - (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component; doesn't get called.

Does [pickerView reloadAllComponents] work as I imagine, changes the dataSource & redraws the content from the UIPickerView?

If not, how should I do that?

Upvotes: 0

Views: 867

Answers (1)

Kex
Kex

Reputation: 776

It was my mistake.

I was creating the same UIPickerView in viewDidLoad in code too: productsPicker = [[UIPickerView alloc] init];

Dumb mistake, but very hard to notice.

Upvotes: 1

Related Questions