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.
精彩评论