views:

197

answers:

2

I'm loading a view from a tableview touched cell that contains a photo that is downloaded from the web. I've set up a busy indicator that is called when the cell is touched and then turn it off in the viewdiddisappear method but when you touch the cell there is still a long pause when the cell is touched then the busy indicator shows up just a second and then it loads the view. Obviously I'm doing this wrong. What is the best way to do this so that the busy indicator turns on first before the pause?

Thanks in advance.

+2  A: 

You can pre-create the busy indicator and set it as hidden on each table cell. If you're taking advantage of UITableView's cell caching then at any given time there are only a few cells floating around so the overhead won't be too much. As soon as you get the selection event from the tablview, unhide the indicator and animate it before doing anything else.

I also found a slight speed increase when starting and stopping spinner animation by setting/unsetting the hidden flag myself (and doing it before starting animation) instead of using the 'auto-hide when stopped' feature. It could have just been my eyes playing tricks but it seemed zippier.

Ramin
A: 

Thanks for the suggestion. The way that I ended up doing it was using multi-threading. Specifically using "operations". Works perfectly now.

Xcoder
(You should mark Ramin's post as the correct answer, not yours :) Just sayin.)
jbrennan