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.
- Add
pod 'KoaPullToRefresh'
to your Podfile. - Edit your app's Info.plist to contain the key:
"Fonts provided by application"
(UIAppFonts
). Then addFontAwesome.ttf
to the list under that key.
- Drag the KoaPullToRefresh/KoaPullToRefresh folder into your project.
- Add the
QuartCore framework
to your project. - Edit your app's Info.plist to contain the key:
"Fonts provided by application"
(UIAppFonts
). Then addFontAwesome.ttf
to the list under that key. - Import
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];
- iOS >= 5.0
- ARC
- Sergi Gracia: [email protected]
- Polina Flegontovna: [email protected]
KoaPullToRefresh is available under the MIT License. See the License file for more info.