PRRefreshControl 0.2.1

PRRefreshControl 0.2.1

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Dec 2015

Maintained by Elethom Hunter.



General

Yet another and better refresh control for scroll views.

Installation

Usage

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!

License

This code is distributed under the terms and conditions of the MIT license.

Donate

You can support me by:

:-)

Contact