开发者

how do you dynamically load a uitableview from a nsarray

so i have a nsmutablearray that populates from a socket message.

problem is, when i call numberofrowsinsection on the uitableview, it will be 0, because it loads from the array. the array has 0 objects, because the incomingMessage hasn't been received yet.

i observe this array in my appdelegate, when it changes, i call r开发者_开发知识库efreshData on the tableView, but it doesn't refresh. how do you load a uitableview from a dynamic array?


[tableView reloadData]; is how you refresh a table. How are you calling your NSArray?

This would be an example of how to add objects to a table from an array:

cell.textLabel.text = [myArray objectAtIndex:indexPath.row];

for numberOfRowsInSection use: [myArray count];


[tableView reloadData];

after you add/remove stuff from the array.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜