Latest 1.0
Homepage https://github.com/xiabob/XBRefreshControl
License MIT
Platforms ios 8.0, requires ARC
Authors

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

XBRefreshControl

要求

  • 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)
}

Latest podspec

{
    "name": "XBRefreshControl",
    "version": "1.0",
    "authors": {
        "xiabob": "[email protected]"
    },
    "homepage": "https://github.com/xiabob/XBRefreshControl",
    "summary": "A pull down RefreshControl by swift.",
    "license": "MIT",
    "source": {
        "git": "https://github.com/xiabob/XBRefreshControl.git",
        "tag": "1.0"
    },
    "source_files": "XBRefreshControl/*.swift",
    "requires_arc": true,
    "platforms": {
        "ios": "8.0"
    },
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This