views:

932

answers:

2

I have a UITableView that I populate with data that i download over the internet. While the data is being downloaded, I want to show a loading label above my TableView to signify to users that something is actually happening and there is not a problem with the app. What is the best way to do this??

+1  A: 

I think the best way to do this is add a subview to the main view of your application. Matt Gallagher had a tutorial on this 2 days ago. He shows you how to show a loading view, it also includes sample code that you can download.

georg
Just wanted to say that if you do use this custom API, be careful with it - Apple doesn't much care fore custom API's last I heard. However this is a very good resource for seeing how this can be achieved.
cdnicoll
A: 

The best way is to add a label and UIActivityIndicator on top of the UITableView in your UIView. In viewDidLoad, set the hidden property of the UILabel to NO and start animating the indicator.

Call a method to download the data in another thread.

[NSThread detachNewThreadSelector...]

Once the downloading is done, call a method on the main thread which will set the UILabel hidden = YES, stop the indicator animation and reload the table.

[self performSelectorOnMainThread...]

Hope that helps.

lostInTransit