Search code examples
iphoneobjective-cuipickerviewreload

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 click on button its shows a pickerview but empty. :( SO can any body tell me how to reload the pickerview like tableView.

Thanx in advance


Solution

  • 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