tags:

views:

127

answers:

1

I'm currently developing an iPhone application that loads data via a webservice into a table. Right now I have it loading the data and creating/displaying my cells via [tableView cellForRowAtIndexPath] on two separate threads. My problem is that I need the data to create my cells.

So currently I load my data into an array on one thread and lock the cell creation part on the other thread until completion. Once completed I go back to my main thread, unlock the cell creation part and continue.

This actually makes the whole process slower. I'm trying to figure out a design so that I can speed up this process. Can someone help?

Thank you to all that reply.

A: 

What exactly do you mean by "locking" and "unlocking" your cell creation?

Usually the design I follow is this -

Let the cells load when the view appears. Start an NSThread to get the data (in viewDidLoad or viewWillAppear). Display an activity indicator till the background thread gets the data.

Once the background thread returns with the data, switch back to main thread, reload your table (so cells are drawn again) and hide the activity indicator.

lostInTransit