LoginSignup
3
3

More than 5 years have passed since last update.

[iOS] Slide Down Refresh TableView -- UIRefreshControl

Last updated at Posted at 2014-11-01

For the table view, you want to slide down the table view to refresh the data of the table view. Maybe you need to add the UIRefreshControl to the TableView.

You can use the UIRefreshControl like this:

func addRefreshControl() {
        refreshControl = UIRefreshControl()
        refreshControl!.addTarget(self, action: "refreshTableView", forControlEvents: UIControlEvents.ValueChanged)
        tableView.addSubview(refreshControl!)
    }

func refreshTableView() 
    //Somthing like tableView.reloadData()
}

After reload the data, maybe the refresh view will not be disappeared. Try to end the refreshing of the UIRefreshControl use the code like this:

refreshControl?.endRefreshing()
3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3