XLRefreshSwift 为您提供了一种简单的方法,在 UIScrollView 中添加下拉刷新。
XLRefreshSwift 通过 CocoaPods 提供。要安装它,只需将以下行添加到 Podfile 中:
pod 'XLRefreshSwift', '~> 0.2.0'
通过设置其 xlheader 属性,将下拉刷新头部添加到 UIScrollView 的子类中。您可以在初始化 XLRefreshHeader 对象时自定义刷新操作。
tableView.xlheader = XLRefreshHeader(action: {
// Put anything you want to do when refreshing
// Please call UIScrollView's method endHeaderRefresh() when you want to end refreshing status
})
通过设置其 xlfooter 属性,将下拉加载更多底部添加到 UIScrollView 的子类中。您可以在初始化 XLRefreshFooter 对象时自定义加载更多操作。
tableView.xlfooter = XLRefreshFooter(action: {
// Put anything you want to do when loading
// Please call UIScrollView's method endFooterRefresh() when you want to end loading status
})
Snowgan,[email protected]
XLRefreshSwift 可在 MIT 许可下使用。有关更多信息,请参阅 LICENSE 文件。