我是 iPhone 开发的新手。
我有数组字典。
{
A = (
{
address = "Talala (gir)";
"main_id" = 1;
mobile = 8878876884;
name = "Amit Patel";
},
{
address = "Junagdh";
"main_id" = 5;
mobile = 4894679865;
name = "Arjun Patel";
}
);
J = (
{
address = "Taveli";
"main_id" = 6;
mobile = 87886356085878;
name = "Jasmin Patel";
},
{
address = "Gujarat";
"main_id" = 4;
mobile = 6636633368;
name = "Jatin ";
}
);
R = (
{
address = "Mumbai";
"main_id" = 2;
mobile = 999686322;
name = "Rajan Patel";
}
);
S = (
{
address = "Rajkot";
"main_id" = 3;
mobile = 8866086549;
name = "Sumit Patel";
}
);
}
我有UITableView
并且我想显示有键"name"
的值UITableViewCell
我的cellForRowAtIndexPath
方法是
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
cell.textLabel.text = [[[self.finalPDic objectForKey:[self.listOfHeader objectAtIndex:indexPath.row]] objectAtIndex:indexPath.row] objectForKey:@"name"];
return cell;
}
但是上面的代码对我来说是粉碎的。