CocoaPods trunk is moving to be read-only. Read more on the blog, there are 19 months to go.

XBRefreshControl 1.0

XBRefreshControl 1.0

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Oct 2016
SwiftSwift Version 3.0
SPMSupports SPM

Maintained by xiabob.



  • By
  • xiabob

下拉刷新控件,纯swift框架,inspired by ODRefreshControl

要求

  • iOS7.0+
  • Xcode 8.0+
  • Swift3.0

安装

将Class目录下的XBRefreshControl.swift、XBScrollViewExtension.swift导入到工程即可

使用

具体使用参看demo工程

  • 第一种使用方法:addTarget
let refresh = XBRefreshControl(activityIndicatorView: UIActivityIndicatorView(activityIndicatorStyle: .Gray), delegate: nil, refreshAction: nil)
tableView.xb_refreshHeader = refresh
refresh.addTarget(self, action: #selector(dropViewDidBeginRefreshing), forControlEvents: .ValueChanged)
  • 第二种使用方法:闭包回调
let refresh = XBRefreshControl { [unowned self](refreshControl) in
    self.dropViewDidBeginRefreshing(refreshControl)
}
tableView.xb_refreshHeader = refresh
  • 第三种使用方法:代理
let refresh = XBRefreshControl(delegate: self)
tableView.xb_refreshHeader = refresh

//XBRefreshControlDelegate
func onRefresh(refreshControl: XBRefreshControl) {
     dropViewDidBeginRefreshing(refreshControl)
}