Latest 1.0.0
Homepage https://github.com/v2panda/PDPullToRefresh
License MIT
Platforms ios 8.0, requires ARC
Authors
  • An easy way to use pull-to-refresh

Gif

Installation

From CocoaPods

Add pod 'PDPullToRefresh' to your Podfile or pod 'PDPullToRefresh', :headif you’re feeling adventurous.

Manually

Important note if your project doesn’t use ARC: you must add the -fobjc-arc compiler flag to UIScrollView+PDHeaderRefreshView.m and UIScrollView+PDFooterRefreshView.m in Target Settings > Build Phases > Compile Sources.

Drag the PDPullToRefresh/PDPullToRefresh folder into your project.
Import PDPullToRefresh.h

Usage

(see sample Xcode project in /PDPullToRefresh)

Adding Pull to Refresh

[tableView pd_addHeaderRefreshWithNavigationBar:YES andActionHandler:^{
    // prepend data to dataSource, insert cells at top of table view
    // call [tableView.pdHeaderRefreshView stopRefreshing] when done
 }];

or if you want pull to refresh from the bottom

[tableView pd_addFooterRefreshWithNavigationBar:YES andActionHandler:^{
    // prepend data to dataSource, insert cells at top of table view
    // call [tableView.pdFooterRefreshView stopRefreshing] when done
 }];

If you’d like to programmatically trigger the refresh (for instance in viewDidAppear:), you can do so with:

[tableView.pdHeaderRefreshView startRefreshing];

Customization

The pull to refresh view can be customized using the following properties/methods:

@property (nonatomic, assign) CGFloat pdHeaderRefreshViewHeight;
@property (nonatomic, assign) CGFloat pdFooterRefreshViewHeight;

For instance, you would set the pdHeaderRefreshViewHeight property using:

// Default is 80
tableView.pdHeaderRefreshViewHeight = 100;

Special Thanks

PDPullToRefresh is Inspired by 半糖AppSVPullToRefresh

License

PDPullToRefresh is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "PDPullToRefresh",
    "version": "1.0.0",
    "license": "MIT",
    "summary": "An easy way to use pull-to-refresh.",
    "homepage": "https://github.com/v2panda/PDPullToRefresh",
    "authors": {
        "v2panda": "[email protected]"
    },
    "source": {
        "git": "https://github.com/v2panda/PDPullToRefresh.git",
        "tag": "1.0.0"
    },
    "requires_arc": true,
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "PDPullToRefresh/PDPullToRefresh/*.{h,m}"
}

Pin It on Pinterest

Share This