Skip to content

Instantly share code, notes, and snippets.

@pingzh
Last active June 3, 2016 05:00
Show Gist options
  • Save pingzh/21213806d4aa94e60839 to your computer and use it in GitHub Desktop.
Save pingzh/21213806d4aa94e60839 to your computer and use it in GitHub Desktop.
private let _refreshControl: UIRefreshControl!
//in addSubviews
tableView.addSubview(refreshControl)
func refreshView() {
refreshControl.beginRefreshing()
tableView.reloadData()
//initData()
refreshControl.endRefreshing()
}
extension xxxxx: UIViewController {
var refreshControl: UIRefreshControl {
if _refreshControl == nil {
_refreshControl.tintColor = UIColor.grayColor()
_refreshControl.addTarget(self, action: "refreshView", forControlEvents: .ValueChanged)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment