问题描述
|
我的UIView中有一个选择器视图和一个Web服务连接,我想用从Web接收到的数据加载选择器视图数据源,但是程序总是首先尝试加载pickerview,然后跳到connectionDidFinishLoading:(NSURLConnection *)connection方法。
我能做什么?
解决方法
创建一个NSMutableArray。当您的数据可用时,填充数组并调用
[pickerView reloadAllComponents]
。这应该调用以下方法:
(NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component
,您可以在其中重新加载标题。