refresh control

2016-10-22  本文已影响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()
}
上一篇 下一篇

猜你喜欢

热点阅读