Use UIActivityIndicatorView to provide a pull-to-refresh function for UIScrollView.
- iOS 8.0+
- Xcode 11.0+
Add pull-up trigger event
[tableView lc_addHeaderRefreshingWithActionHandler:^{
}];Manual refresh
[tableView lc_beginHeaderRefreshing];Add dropdown trigger event
[tableView lc_addFooterRefreshingWithActionHandler:^{
}];Add dropdown trigger event
[tableView lc_beginFooterRefreshing];Because only one UIActivityIndicatorView is created, lc_endRefreshing will end all refreshes.
[self.tableView lc_endRefreshing];You can set horizontal or vertical refresh.
tableView.lc_refreshScrollDirection = LCRefreshScrollDirectionHorizontal;To integrate LCPullRefresh into your Xcode project using CocoaPods, specify it in your Podfile:
pod 'LCPullRefresh'- Download everything in the LCPullRefresh folder;
- Add (drag and drop) the source files in LCPullRefresh to your project;
- Import
UIScrollView+LCPullRefresh.h.
LCPullRefresh is provided under the MIT license. See LICENSE file for details.