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

ZRefreshing 1.3.1

ZRefreshing 1.3.1

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Jul 2017
SPMSupports SPM

Maintained by Zev.



  • By
  • zevwings

ZRefreshing

ZRefreshing is a simple swift Refreshing Control.

Installation

Manual

1. Download this project, And drag ZRefreshing.xcodeproj to your own project.
2. In your target’s General tab, click the ’+’ button under Linked Frameworks and Libraries.
3. Select the ZRefreshing.framework to Add to your platform. 

Usage

Header

1. add header into your tableView
var header = ZRefreshNormalHeader(target: self, action: #selector(self.loadData(_:)))
var header = ZRefreshNormalHeader({
})
self.tableView.header = header
2. start refreshing
self.tableView.header?.beginRefreshing()
3. stop refreshing
self.tableView.header?.endRefreshing()
4. hidden the last update label
header.lastUpdatedTimeLabelHidden = true
5. hidden the state label
header.stateLabelHidden = true
6. store the time with the custom key
header.lastUpdatedTimeKey = "custom key"
7. when you set a contentInset, you need set a ignored height
self.tableView.contentInset = UIEdgeInsetsMake(30, 0, 0, 0)
header?.ignoredScrollViewContentInsetTop = 30
8. also, you can set the indicator style
self.header.activityIndicatorViewStyle = .WhiteLarge



Footer

1. add auto footer into your tableView
var footer = ZRefreshAutoFooter(target: self, action: #selector(self.loadData(_:)))
self.tableView.footer = ZRefreshAutoFooter({
})
self.tableView.footer = footer
2. add normal footer into your tableView
var footer = ZRefreshBackFooter(target: self, action: #selector(self.loadData(_:)))
var footer = ZRefreshBackNormalFooter({
})
3. stop refreshing
self.tableView.footer?.endRefreshing()
self.tableView.footer?.endRefreshingWithNoMoreData()

note: you can use following function reset the refresh state

self.tableView.footer?.resetNoMoreData()
4. the footer can auto hide
self.footer.automaticallyHidden = true

note: you can set the page size for the footer, when your rows count less than pageSize auto hide the footer

self.footer.pageSize = 20
5. hidden the state label
self.footer.stateLabelHidden = true
6. when you set a contentInset, you need set the ignore height to ajust the view
self.tableView.contentInset = UIEdgeInsetsMake(0, 0, 30, 0)
self.footer.ignoredScrollViewContentInsetBottom = 30
7. also, you can set the indicator style
self.footer.activityIndicatorViewStyle = .WhiteLarge
8. disable the automic refresh for a AutoRefreshFooter
self.footer.automaticallyRefresh = false