📅  最后修改于: 2022-03-11 14:55:18.882000             🧑  作者: Mango
var refreshControl = UIRefreshControl()
override func viewDidLoad() {
super.viewDidLoad()
refreshControl.attributedTitle = NSAttributedString(string: "Pull to refresh")
refreshControl.addTarget(self, action: #selector(refresh(_:)), for: UIControl.Event.valueChanged)
tableView.addSubview(refreshControl) // not required when using UITableViewController
}
@objc func refresh(sender:AnyObject) {
// Code to refresh table view
}