3 回答

TA貢獻(xiàn)1817條經(jīng)驗(yàn) 獲得超6個(gè)贊
拉動(dòng)刷新是iOS內(nèi)置的。您可以像
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
}
在某些時(shí)候,您可能會(huì)刷新。
refreshControl.endRefreshing()
- 3 回答
- 0 關(guān)注
- 607 瀏覽
添加回答
舉報(bào)