我有Tableview,其中的各个部分是从AZ的(没有固定的部分,我是动态计算的)

我想这样显示:

我的数组值:msg_array = [“ AajKaCatch”,“ AajKaItem”,“ Anari”,“ Big C Mobiles”,“ Big Flix”,“ BigRock”,“ caksonflowers,....”]

当我尝试在cellForRowAtIndexPath中显示这样时,它显示NSInvalidArgumentException

cell.textLabel.text=[[[msg_array objectAtIndex:indexPath.section] objectAtIndex:indexPath.row] objectForKey:@"Merchant_Name"];

请帮助,并提前感谢。

最佳答案

您的数组就像:

array{object,object,object,object,object};


在这种情况下,您不能这样使用:

[[msg_array objectAtIndex:indexPath.section] objectAtIndex:indexPath.row]


因为要实现这种功能,[msg_array objectAtIndex:indexPath.section]应该返回一个数组。

因此,要实现这一点,您需要尝试这样:

array{array{objects starts with 'A'},array{objects starts with 'B'},array{objects starts with 'C'}};

07-28 02:37
查看更多