KoaPullToRefresh is a minimal & easily customizable pull-to-refresh control. You can change the font, colors, size and even replace the spinning icon using FontAwesome. This library is very easy to add and customize. This pull to refresh control is developed for Teambox and is based on the SVPullToRefresh and use ios-fontawesome to work with font awesome icons.
pod 'KoaPullToRefresh'
to your Podfile."Fonts provided by application"
(UIAppFonts
). Then add FontAwesome.ttf
to the list under that key.QuartCore framework
to your project."Fonts provided by application"
(UIAppFonts
). Then add FontAwesome.ttf
to the list under that key.KoaPullToRefresh.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:KoaPullToRefreshStateStopped];
[self.tableView.pullToRefreshView setTitle:@"Release" forState:KoaPullToRefreshStateTriggered];
[self.tableView.pullToRefreshView setTitle:@"Loading" forState:KoaPullToRefreshStateLoading];
Start animating KoaPullToRefresh (viewDidLoad
)
[self.tableView.pullToRefreshView startAnimating];
Stop animating KoaPullToRefresh
[self.tableView.pullToRefreshView stopAnimating];
KoaPullToRefresh is available under the MIT License. See the License file for more info.