So my question is: How can I wait to load the tableview until the data is loaded.
Unfortunately I can't use connectionDidFinishLoading in a while loop because it's a void message.
Any suggestions?
So my question is: How can I wait to load the tableview until the data is loaded.
Unfortunately I can't use connectionDidFinishLoading in a while loop because it's a void message.
Any suggestions?
On other platforms I've used, a writer can lock the table. It will not write until it gets the lock. The reader if it issues a read will block until the lock is removed by the writer. On many systems this is effisent as no polling is involved the system only checks when lock states change
Sounds like you're going about it the wrong way. You should let the tableView go ahead and load empty when the view is loaded. Once the data has been downloaded and stored in your datasource you should set up a delegate method in your table view controller to update the table view to display your new data.
A great way to update the table view is:
Code:
[tableView beginUpdates];
// insert some rows, do whatever updates
[tableView endUpdates];
That will animate all of the updates in the begin/end block in a very nice way. It's pretty neat. For more information check out the documentation on UITableView.
Wirelessly posted (Mozilla/5.0 (iPod; U; CPU iPhone OS 4_3 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8F5153d Safari/6533.18.5)
Yep. Now I got. Very simple. I created a NSoperationqueue in viewdidload and a delegate. after the connection did finish launching method, a method gets called to set the data for the table view and than reload its data. I think that's the best way to go and the UI doesn't get stuck either.