2012-01-06 28 views
0

如何将此数组填充到uitableviewcell。我曾尝试过下面这个,但没有成功。向utiableview填充数组

cell.textlabel.text = [array objectatIndex:indexpath.row]; 

so pls。指导更好的解决方案。

{ 
     name = nick; 
     surname = xyz; 
     timeCreated = "2012-01-06 04:03:03 +0000"; 
     timeUpdated = "1999-11-30 00:00:00 +0000"; 
     userID = 1; 
     userno = 0; 
    }, 
     { 
     name = samuel; 
     surname = xyz; 
     timeCreated = "2012-01-06 04:03:24 +0000"; 
     timeUpdated = "1999-11-30 00:00:00 +0000"; 
     userID = 2; 
     userno = 1; 
    }, 
     { 
     name = John; 
     surname = xyz; 
     timeCreated = "2012-01-06 04:03:48 +0000"; 
     timeUpdated = "1999-11-30 00:00:00 +0000"; 
     userID = 3; 
     userno = 2; 
    } 
+0

这是一个JSON文件内容:而不是从对象(在你的例子看起来可能是JSON解析成一个NSDictionary)

例如内分配一个值? – Ilanchezhian 2012-01-06 04:45:59

回答

1

不要将对象从数组中分配给文本标签的文本属性。

cell.textlabel.text = [(NSDictionary*)[array objectAtIndex:indexpath.row] objectForKey:@"name"]; 
+0

我正在使用以上格式返回数组的kumulos api的应用程序。现在我想将这个数组的所有值填充到uitablviewcell。但我不知道该怎么做。 – mashios 2012-01-06 06:00:29

+0

返回数组中的对象的类是什么? – jonkroll 2012-01-06 06:50:44

+0

我已经解决了问题,谢谢。 – mashios 2012-01-06 07:10:18