Reputation:
I display a view, and the data to populate one of the picker views comes down over the network after the app has loaded the view, so the picker view gets passed null so shows no items to pick from.
Is there away I can tell the UI to reload?
The view hierarchy is
Tabbar->Navbar->scrollview->Pickerviewcontroller
If the above is relevant.
Upvotes: 0
Views: 2750
Reputation: 2501
You can use NSNotificationCenter to post a notification to update the picker when the data has finished loading
Create the notification
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(refreshPicker) name: @"WEBSERVICE_UPDATED" object:nil];
Post the notification
[[NSNotificationCenter defaultCenter] postNotificationName:@"WEBSERVICE_UPDATED" object:lesson];
-(void)refreshPicker {
// Handle refresh here
[pickerViewController reloadAllComponents];
}
Upvotes: 0
Reputation: 4041
assuming you have the datasource set up correctly, once it gets the data, call reloadAllComponents.
[pickerViewController reloadAllComponents];
Upvotes: 1