访问NSMutableArray中的字典值

时间:2014-07-18 11:04:04

标签: ios uitableview nsmutablearray

catArray-->
{
"category_logo" = "category_logo/blue.png";
"category_name" = "Health & Wellness";
id = 9;
}

我必须获取" category_name"在我的tableview

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath  :    (NSIndexPath *)indexPath
{

    static NSString *CellIdentifier = @"catCell";

    catCell=(catCell *)[tableView  dequeueReusableCellWithIdentifier:CellIdentifier];

    if(categoryTableCell==nil){
        [[NSBundle mainBundle] loadNibNamed:@"CategoryTableCell" owner:self options:nil];
    }


      ???????= [self.categoryListArray objectAtIndex:indexPath.row];
      categoryTableCell.dataLabel.text = ??????

}

请帮我在标签文字中设置。我怎么写代替问号?

1 个答案:

答案 0 :(得分:1)

假设你的catArray是一个NSDictionaries数组,它将如下所示:

NSString *s= self.categoryListArray[indexPath.row][@"category_name"];

categoryTableCell.textLabel.text=s;