美文网首页
refresh control

refresh control

作者: 四毛哥掉落的鳞片 | 来源:发表于2016-10-22 17:57 被阅读0次
override func viewDidLoad() {
    super.viewDidLoad()
    
    self.tableView.tableFooterView = UIView(frame: CGRect.zero)
    
    // refresh control
    let refreshControl = UIRefreshControl()
    refreshControl.backgroundColor = UIColor.clear
    refreshControl.tintColor = UIColor.red
    refreshControl.addTarget(self, action: #selector(refresh(refreshControl:)), for: .valueChanged)
    self.tableView.addSubview(refreshControl)
}

// selector for refresh control
func refresh(refreshControl: UIRefreshControl) {
    
    // to be done in the future.
    print("refresh")
    
    refreshControl.endRefreshing()
}

相关文章

网友评论

      本文标题:refresh control

      本文链接:https://www.haomeiwen.com/subject/jcshuttx.html