How to reload UIPickerView in iPhone?
hi I am working on an iPhone app & i have to show some thing on a pickerview after receiving a response from socket, Methods of PickerView are check when application is going to be load. in my app i have to load PickerView on a button click.
After getting response in an array, When i cli开发者_如何学编程ck on button its shows a pickerview but empty. :( SO can any body tell me how to reload the pickerview like tableView.
Thanx in advance
you could use either reloadAllComponents
to realod all the component or reloadComponent
to a zero-indexed number identifying a component of the picker view.
[myPickerView reloadAllComponents];
[myPickerView reloadComponent:IndexOfReloadComponent];
Read UIPickerView documentation
You can use below code, I hope it's work
[obj_Picker reloadAllComponents];
Call -reloadComponent:
or -reloadAllComponents
(methods on UIPickerView).
Quote:
You can dynamically change the rows of a component by calling the reloadComponent: method, or dynamically change the rows of all components by calling the reloadAllComponents method. When you call either of these methods, the picker view asks the delegate for new component and row data, and asks the data source for new component and row counts. Reload a picker view when a selected value in one component should change the set of values in another component. For example, changing a row value from February to March in one component should change a related component representing the days of the month.
Use this method - (void)reloadAllComponents
of the UIPickerView class.
精彩评论