0

I have a class inheriting from UITableView, which shows results from an XML feed. I want to add a UIActivityView to that page. Here is my desired functionality:

  1. When the page is loading, the TableView is hidden. Only the UIActivityView is available. The UIActivityView is centered on screen.

  2. When the content is done, the UIActivityView disappears. The TableView shows up.

How can this be done?

Joseph Anderson
  • 4,114
  • 4
  • 45
  • 99

1 Answers1

2
  1. Just add a subview (the activity indicator) to your UITableViewController's view in ViewDidLoad would be a good place)
  2. Prepare the data to be shown in the table view (use a separate thread to keep the activity wheel spinning).
  3. When done, remove the activity indicator.
  4. Call ReloadData() on your table view

You can find examples in ObjC here on SO: How to set an UIActivityIndicatorView when loading a UITableViewCell

You might also consider showing the indicator in a cell of your view, just as an alternative.

Community
  • 1
  • 1
Krumelur
  • 32,180
  • 27
  • 124
  • 263