UIPickerView reloadData

2020-06-08 06:41发布

I'm changing components (in particular, the number and color of components), in a UIPickerView that I call pickerOne, so after making the changes, I call:

[pickerOne reloadData];

and it appears to be working perfectly however, I'm getting a compile warning:

warning: 'UIPickerView' may not respond to '-reloadData'

Although this appears to work, is there something else that I should use to reload data?

Thanks

3条回答
时光不老,我们不散
2楼-- · 2020-06-08 07:03

I think you should be using: reloadComponent or reloadAllComponents.

But these methods are useless unless you connect UIPickerViewDalegate and UIPickerViewDataSource to file owner.

查看更多
做自己的国王
3楼-- · 2020-06-08 07:17

You should be calling reloadComponent: or reloadAllComponents:.

There may be a private reloadData used under the covers, but it's not part of the public API, and therefore, shouldn't be relied upon.

查看更多
太酷不给撩
4楼-- · 2020-06-08 07:21

I think you should be using:

reloadComponent:

or

reloadAllComponents:

查看更多
登录 后发表回答