I recently implemented pull to refresh here: https://github.com/leah/PullToRefresh. It kind of works however it gets stuck with a spinning activity indicator. Their is also
Without code there's not much anyone can say, but maybe try a different implementation of Pull To Refresh, like the enormego (EGO) version, the code is at github, here
It's used in the Facebook app so it definitely works.
I found this library very useful, fancy and up-to-date: https://github.com/Yalantis/Pull-to-Refresh.Rentals-iOS
(Recommendations from other answers seem old and not maintained)
I am new to iOS development and I was trying to implement the pull to refresh in iOS 6. Well looking for a solution, I stumbled across this blog post and found it to be very helpful, http://www.intertech.com/Blog/Post/iOS-6-Pull-to-Refresh-(UIRefreshControl).aspx. It lays out the steps to implementing pull to refresh in a way that is easy to follow. Anyone looking to do this themselves in iOS 6 should check out the blog.
The UIRefreshControl is only useable with a Table View currently. There are a few steps to follow to successfully add a refresh control:
1. Create a callback method to handle your refresh logic. The callback method should be invoked when a user pulls down on the table view. The signarture of the method should take one parameter: a pointer to the UIRefreshControl.
Note: Steps 2-4 are all done within the Table View Controller’s viewDidLoad method.
2. Instantiate the UIRefreshControl with a basic "alloc/init".
3. Connect an action to the refresh control to invoke your callback method when the ValueChange event is fired.
4. Add the refresh control to the Table View Controller's "refreshControl" property.
You can use : https://github.com/ngocbinh02/httablekit
Support iOS 5.0 or later
Pull to refresh tableview
import <HTTableKit/TableKit>
....
//like UIRefreshControll
[tableview setPullToRefreshControlType:UITableViewRefreshControlTypeSystem];
[tableview setPullToRefreshModeEnable:YES beginHandler:^{
// to do here when pulling to refresh
}];
Dismiss pull to refresh tableview
import <HTTableKit/TableKit>
....
[tableview dismissPullToRefreshEndHandler:^{
// to do here when dismissing
}];
I prefer the EGO implementation than the leah one because it does not require a subclass of your view controller. The original EGO one in github is a bit of a mess with no .gitnore file and lots of .DS_Store files added unnecessarily. Take a look at some of the many forks and pick one.
The "emreberge" fork looks like a good version, better file organisation and documentation too!
https://github.com/emreberge/EGOTableViewPullRefresh
Here's our tutorial on Custom Pull-to-Refresh controls, with code for Objective-C and Swift: http://www.jackrabbitmobile.com/design/ios-custom-pull-to-refresh-control/
To add additional text or images, as you mentioned, add them into self.refreshLoadingView
in the setupRefreshControl
or scrollViewDidScroll
methods (from the tutorial).
Let me know if that helps!