Swift3.0
var refreshControl: UIRefreshControl!
override func viewDidLoad() {
super.viewDidLoad()
refreshControl = UIRefreshControl()
refreshControl.attributedTitle = NSAttributedString(string: "Pull to refresh")
refreshControl.addTarget(self, action: #selector(self.refresh), for: UIControlEvents.valueChanged)
tableView.addSubview(refreshControl)
}
func refresh(sender:AnyObject) {
// your code to refresh tableView
}
Comments
Post a Comment