Latest2.0.5
Homepagehttps://github.com/showmecode/RefreshControl
LicenseMIT
Platformsios 7.0, requires ARC
FrameworksFoundation, UIKit
Authors

How does it look like ?

RefreshControl 
RefreshControl 
RefreshControl 

RefreshControl 
RefreshControl 
RefreshControl 

RefreshControl 
RefreshControl 
RefreshControl 

RefreshControl 
RefreshControl 

How to use ?

Podfile

pod 'RefreshControl'

Project

#import "UIScrollView+RefreshControl.h"

Sensitive Style

TopRefreshControl

    __weak typeof(self) weakSelf = self;
    [self.tableView addTopRefreshControlUsingBlock:^{
        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
          // request for datas
    });
        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.7 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
            [weakSelf.tableView reloadData];
            [weakSelf.tableView topRefreshControlStopRefreshing];
        });
    } refreshControlPullType:RefreshControlPullTypeInsensitive refreshControlStatusType:RefreshControlStatusTypeText];

Attention: In call back block, you should reload data first, then stop TopRefreshControl animation, otherwise, your content focus will go to top.

BottomRefreshControl

    __weak typeof(self) weakSelf = self;
    [self.tableView addBottomRefreshControlUsingBlock:^{        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
          // request for datas
        });
        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
            [weakSelf.tableView reloadData];
            [weakSelf.tableView bottomRefreshControlStopRefreshing];
        });
    } refreshControlPullType:RefreshControlPullTypeSensitive refreshControlStatusType:RefreshControlStatusTypeText];

Attention: In call back block, you should always reload data first, then stop BottomRefreshControlanimation, otherwise, your content bottom will always go to screen bottom.

Initialize refreshing

    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        [self.tableView topRefreshControlStartInitializeRefreshing];
    });

Insensitive Style & StatusType

typedef NS_ENUM(NSInteger, RefreshControlPullType) {
    RefreshControlPullTypeSensitive,
    RefreshControlPullTypeInsensitive
};

typedef NS_ENUM(NSInteger, RefreshControlStatusType) {
    RefreshControlStatusTypeTextAndArrow,
    RefreshControlStatusTypeText,
    RefreshControlStatusTypeArrow
};

Pass refreshControlPullType RefreshControlPullTypeInsensitive

TopRefreshControl

addTopRefreshControlUsingBlock:refreshControlPullType:refreshControlStatusType

BottomRefreshControl

addBottomRefreshControlUsingBlock:refreshControlPullType:refreshControlStatusType

By the way

You can change the status text and color, loading animation circle color and arrow color.

@property (nonatomic, strong) NSString *topRefreshControlPullToRefreshingText;
@property (nonatomic, strong) NSString *topRefreshControlPullReleaseToRefreshingText;

@property (nonatomic, strong) NSString *bottomRefreshControlPullToRefreshingText;
@property (nonatomic, strong) NSString *bottomRefreshControlPullReleaseToRefreshingText;

@property (nonatomic, strong) UIColor *statusTextColor;
@property (nonatomic, strong) UIColor *loadingCircleColor;
@property (nonatomic, strong) UIColor *arrowColor;

You can set refresh failure status text

topRefreshControlRefreshFailureWithHintText:
bottomRefreshControlRefreshFailureWithHintText:

You can handle touch event by you self

addTouchUpInsideEventForTopRefreshControlUsingBlock:
addTouchUpInsideEventForBottomRefreshControlUsingBlock:

If you don’t handle this event, we will refresh again when you touch RefreshControl or pull again. Of course, after you handle this event, you wanna refresh again, call flow message or pull

topRefreshControlResumeRefreshing
bottomRefreshControlResumeRefreshing

Latest podspec

{
    "name": "RefreshControl",
    "version": "2.0.5",
    "summary": "RefreshControl is an useful pull to refresh control for ios developer",
    "description": "tttttpull to refresh trigger refresh mode is divided into traditional andntttttautomatically trigger refresh mode, the new model allows users to feel thentttttpresence of the control, enhance the user experiencen",
    "homepage": "https://github.com/showmecode/RefreshControl",
    "license": "MIT",
    "authors": {
        "Moch": "[email protected]"
    },
    "platforms": {
        "ios": "7.0"
    },
    "source": {
        "git": "https://github.com/showmecode/RefreshControl.git",
        "tag": "2.0.5"
    },
    "requires_arc": true,
    "source_files": "RefreshControl/Source/*.{h,m}",
    "frameworks": [
        "Foundation",
        "UIKit"
    ]
}

Pin It on Pinterest

Share This