2012-01-06 45 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