📢
EasyPullToRefresh
轻松集成下拉刷新,无需任何麻烦。一行代码即可处理空表格视图。无需添加到 Storyboard 或 xib 或代码中。
📚
示例要运行示例项目,首先克隆仓库,然后从 Example 目录中运行 pod install
。
⏳
安装EasyPullToRefresh 通过 CocoaPods 提供使用。安装它,只需将以下行添加到 Podfile 中即可
pod 'EasyPullToRefresh'
💡
使用在 viewcontroller 类中导入 pod。
import EasyPullToRefresh
安装后,下拉刷新将可供项目中每个表格视图使用。使用以下回调处理刷新事件。
self.tableView.customRefresh {
// You can do your API call here
}
类似地,如果表格视图为空,则会显示一条消息和一个重新加载按钮。使用以下回调来处理重新加载事件。
self.tableView.customReload {
// You can do your API call here
}
如果您不喜欢颜色和主题,可根据您的需求覆盖所有控件。您可以覆盖UIRefreshControl、ReloadButton和DataEmptyLabel的默认颜色和外观。使用以下变量名称来访问控件:
// 1: Disable pull to refresh using the flag
self.tableView.showPullToRefresh = false
// 2: Disable empty tableview message and reload button
self.tableView.showReloadOnEmpty = false
// 3: Customize the UiRefreshControl
self.tableView.customRefreshControl.backgroundColor = UIColor.green
self.tableView.customRefreshControl.tintColor = UIColor.green
// 4: Override custom message for empty tableview using below label
self.tableView.customEmptyMessageLabel.text = "YOUR CUSTOM TEXT FOR EMPTY LIST"
// 5: Customize the Reload button for empty tableview
self.tableView.customReloadButton.backgroundColor = UIColor.green
self.tableView.customReloadButton.layer.borderColor = UIColor.red.cgColor
😇
作者我的电子邮件地址,[email protected]
![]() Harshal Jadhav |
许可证
都是您的