Pull to Refresh (ios)

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.


Apple has introduced UIRefreshControl in iOS6. You can integrate it in your UITableViewController using

- (void)viewDidLoad {
    [super viewDidLoad];
    // Initialize Refresh Control
    UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init];
    // Configure Refresh Control
    [refreshControl addTarget:self action:@selector(refresh:) forControlEvents:UIControlEventValueChanged];
    // Configure View Controller
    [self setRefreshControl:refreshControl];
}

the refresh: method will trigger the update and you can stop it in your API callback using:

 [(UIRefreshControl *)sender endRefreshing];

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.