DRKPullToRefresh is a clean and customisable pull-to-refresh component that uses SpinKit animations. You can change the font, colors, size and animations from SpinKit. This is based on KoaPullToRefresh that sports a very simple and clear design.
- Add
pod 'DRKPullToRefresh'
to your Podfile.
- Drag the DRKPullToRefresh/DRKPullToRefresh folder into your project.
- Add the
QuartCore framework
to your project. - Import
DRKPullToRefresh.h
.
Add this in your viewDidLoad
:
[tableView addPullToRefreshWithActionHandler:^{
// Tasks to do on refresh. Update datasource, add rows, …
// Call [tableView.pullToRefreshView stopAnimating] when done.
}];
Adding background color:
[tableView addPullToRefreshWithActionHandler:^{
// Tasks to do on refresh. Update datasource, add rows, …
// Call [tableView.pullToRefreshView stopAnimating] when done.
} withBackgroundColor:[UIColor blueColor]];
Adding the height of showed pixels:
[tableView addPullToRefreshWithActionHandler:^{
// Tasks to do on refresh. Update datasource, add rows, …
// Call [tableView.pullToRefreshView stopAnimating] when done.
} withBackgroundColor:[UIColor blueColor] withPullToRefreshHeightShowed:2];
Set the color of fontAwesome icon and text:
[self.tableView.pullToRefreshView setTextColor:[UIColor whiteColor]];
Set the text font:
[self.tableView.pullToRefreshView setTextFont:[UIFont fontWithName:@"OpenSans-Bold" size:14]];
Set the font awesome icon:
[self.tableView.pullToRefreshView setFontAwesomeIcon:@"icon-refresh"];
Set titles:
[self.tableView.pullToRefreshView setTitle:@"Pull" forState:DRKPullToRefreshStateStopped];
[self.tableView.pullToRefreshView setTitle:@"Release" forState:DRKPullToRefreshStateTriggered];
[self.tableView.pullToRefreshView setTitle:@"Loading" forState:DRKPullToRefreshStateLoading];
Start animating DRKPullToRefresh (viewDidLoad
)
[self.tableView.pullToRefreshView startAnimating];
Stop animating DRKPullToRefresh
[self.tableView.pullToRefreshView stopAnimating];
- iOS >= 5.0
- ARC
- govirulez at gmail dot com
DRKPullToRefresh is available under the MIT License. See the License file for more info.