HKRefreshControl 1.0.0

HKRefreshControl 1.0.0

测试已测试
语言语言 Obj-CObjective C
许可证 MIT
发布最后发布2014年12月

Panos Baroudjian 维护。




  • Panos Baroudjian

Screenshot

HKRefreshControl 是一个刷新控件,它模仿 iOS6 的 UIRefreshControl 行为,但也适用于 iOS5。它使用 HKCircularProgressView 来显示动画的“下拉进度”和“活动指示器”视图,但您也可以实现自己的视图。

如何使用它

  1. 通过在 Podfile 中添加 `pod 'HKRefreshControl'` 来使用 CocoaPods。
  2. 手动
    • 克隆此仓库
    • 将 HKRefreshControl 和 UITableViewController+HKRefreshControl 文件(.h 和 .m)复制到您的项目中,并不要忘记 HKCircularProgressView

如何配置它

刷新控件通常与 UITableView 一起使用。这就是我们为什么要扩展 UITableViewController 类来模仿 UIRefreshControl 的用法。

为了将您的 UITableView 与 HKRefreshControl 关联

  • 在您的 UITableViewController 中,设置 customRefreshControl 属性(使用简单的 [[HKRefreshControl alloc] init])。
  • 添加对 UIControlEventValueChanged 控制事件的目标和操作。
  • 当触发 UIControlEventValueChanged(当控件被拉时),开始刷新您的数据。
  • 当数据刷新完成时,在 HKRefreshControl 上调用 endRefreshing,它将停止动画并隐藏控件。

像 UIRefreshControl 一样,您可以自定义 HKRefreshControl

  • tintColor: 设置指示器视图和标签的文字颜色(通过 UIAppearance API 可用)。
  • attributedTitle: 使用此属性在控件底部设置标签。