2011-03-13 79 views
0

HTTP請求後,我接收JSON數組解碼的:JSON陣列分成的tableView細胞

NSArray *jsonArray = [stringResponse JSONValue]; 

陣列看起來像:

(
{ 
    id = 0000000002; 
    ora = "15:00:00"; 
    oraArrivo = "21:20:00"; 
}, 
    { 
    id = 0000000001; 
    ora = "19:20:00"; 
    oraArrivo = "23:30:00"; 
} 
) 

現在我在一個插入每數組項uitableview行。我試過:

cell.textLabel.text = [self.jsonArray objectAtIndex:indexPath.row]; 

但它不工作。我可能需要更多。

「原始」的UITableView的代碼我編輯的另一部分是:

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ 
return jsonArray.count; 
} 

我只需要有行中的tableView像

「出發時間是15:00:00到貨時間是21:20:00「

任何有關如何使其工作的建議?

謝謝。

回答

0

解決了

NSDictionary *dict = [self.jsonArray objectAtIndex: indexPath.row]; 
    cell.textLabel.text = [dict objectForKey:@"ora"]; 
    cell.detailTextLabel.text = [dict objectForKey:@"oraArrvo"];