引用第三方控件MJRefresh
添加如下代码即可:
override func viewDidLoad() {
super.viewDidLoad()
tableView.mj_header = MJRefreshNormalHeader{
self.Delay(1, closure: { () -> () in
self.tableView.mj_header.endRefreshing()
self.tableView.reloadData()
})
}
}
func Delay(time:Double,closure:()->()){
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, Int64(time * Double(NSEC_PER_SEC))), dispatch_get_main_queue(), closure)
}