TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Dec 2015 |
Maintained by Elethom Hunter.
Yet another and better refresh control for scroll views.
Setup in -viewDidLoad
in your view controller class:
- (void)viewDidLoad
{
[super viewDidLoad];
...
PRRefreshControl *refreshControl = [[PRRefreshControl alloc] init];
[refreshControl addTarget:self
action:@selector(refreshControlTriggered:)
forControlEvents:UIControlEventValueChanged];
self.refreshControl = refreshControl;
[collectionView insertSubview:refreshControl atIndex:0];
// Configure manually if needed
CGFloat customMarginTop = 10.f;
refreshControl.scrollViewContentInset = collectionView.contentInset;
refreshControl.height -= customMarginTop;
refreshControl.verticalOffset = customMarginTop * .5f;
...
}
Respond to actions:
#pragma mark - Data
- (void)dataDidRefresh
{
[self.refreshControl endRefreshing];
}
#pragma mark - Actions
- (void)refreshControlTriggered:(PRRefreshControl *)sender
{
[self refreshData];
}
All done!
This code is distributed under the terms and conditions of the MIT license.
You can support me by:
:-)