This has been around for a while but apple standardized it finally.
in the .h file of your tableview or collectionview or pretty much any view;
in the .h file of your tableview or collectionview or pretty much any view;
@interface myViewController : UICollectionViewController {
//all your other declarations
UIRefreshControl *refreshControl;
}
In your .m file, wherever you initialize the view;
if (self) {
//other special setup items once you know your view exists
refreshControl = [[UIRefreshControl alloc] initWithFrame:CGRectMake(0, -44, 320, 44)];
[refreshControl addTarget:self action:@selector(reload:) forControlEvents:UIControlEventValueChanged];
[self.collectionView addSubview:refreshControl];
}
- (void) reload:(id) sender {
//all your reload commands go here like [tableview reloaddata];
}