I have a Tabbed Application.
The application begins on a tab whose view is a UITableViewController.
On initial load of the application, a MBProgressHUD activity indicator is used to indicate to the user that the application is currently loading the data for the rows.
If the user at any time wants to refresh the data in the TVC, they can swipe/pull down, which will utilize the UIRefreshControl activity indicator at the top of the TVC.
My issue is... this isn't consistent across both forms of loading the data.
I need to pick either just MBProgressHUD, or just UIRefreshControl.
I would like the latter. Is there a way then, to use UIRefreshControl's Activity Indicator open initial loading of my TVC, without the user ever having initiated it?
Using UIRefreshControl
simply call [self.refreshControl beginRefreshing]
to display the refresh indicator when your view loads (like in your viewDidAppear
for example).
This will display the refresh control as if the user did pull to refresh manually.
Note: this will only display the control if the tableView is scrolled to top. If the tableView has an offset when you call beginRefreshing
iOS does not scroll the tableView to the top just to show the refresh control, to avoid scrolling the tableview unexpectedly (so if you wish the tableView to scroll it to the top to ensure the refreshControll is shown in any case, you'll have to use setContentOffset:
first to scroll the tableView to the top before calling beginRefreshing
)