UIPickerView reloadData

ぐ巨炮叔叔 提交于 2019-12-04 17:35:46

问题


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


回答1:


I think you should be using:

reloadComponent:

or

reloadAllComponents:




回答2:


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.




回答3:


I think you should be using: reloadComponent or reloadAllComponents.

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



来源:https://stackoverflow.com/questions/3206924/uipickerview-reloaddata

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!