我正在將一個位置的源解析爲名爲items的NSMutableArray
。我填充一個UIPickerView
如下:從Feed中填充UIPickerView
- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)thePickerView {
return 1;
}
- (NSInteger)pickerView:(UIPickerView *)thePickerView numberOfRowsInComponent:(NSInteger)component {
return [items count];
}
- (NSString *)pickerView:(UIPickerView *)thePickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component {
return [items objectAtIndex:row];
}
-(void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row
inComponent:(NSInteger)component
{
id item = [items objectAtIndex:row];
NSString *occasion = [item objectForKey:@"name"];
location.text = occasion;
}
當我這樣做沒有任何值出現在UIPickerView,有人可以幫我這個好嗎?一切連接正確
通過這樣做,我得到以下錯誤***終止應用程序,由於未捕獲的異常'NSInternalInconsistencyException',原因:'在無效索引路徑( 2個索引[0,0])'' –
2013-02-22 11:43:21
您要傳遞的請求字典我想這樣嘗試通過NSString對象 – 2013-02-22 11:46:35
你可以給我一些方向做這個請,我真的很感激它 – 2013-02-22 11:52:01