Does anyone have a short example of how to implement the new UIRefreshControl
into xcode. I have a UITableViewController
which displays Tweets, want to be able to pull down and refresh.
You can just set it up in your viewDidLoad
, if you have a UITableViewController
:
UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init];
[refreshControl addTarget:self action:@selector(refresh)
forControlEvents:UIControlEventValueChanged];
self.refreshControl = refreshControl;
Then you can do your refresh stuff here:
-(void)refresh {
// do something here to refresh.
}
When you are done with refreshing, call [self.refreshControl endRefreshing];
to stop the refresh control, as pointed out by rjgonzo.