iOS 下拉刷新:VASRefreshControl

jopen 9年前發布 | 11K 次閱讀 iOS開發 移動開發 VASRefreshControl

VASRefreshControl 簡單的下拉刷新,支持 RACCommand。

iOS 下拉刷新:VASRefreshControl

Cocoapods:

pod 'VASRefreshControl', :git => 'https://github.com/spbvasilenko/VASRefreshControl.git'

How to use:

1) Create RACCommand, if you need for this:

- (RACCommand *)refreshCommand
{
    if (!_refreshCommand) {
        _refreshCommand = [[RACCommand alloc] initWithSignalBlock:^RACSignal *(id input) {
            return [RACSignal createSignal:^RACDisposable *(id<RACSubscriber> subscriber) {

                dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
                    NSLog(@"Signal execute!");
                    [subscriber sendCompleted];
                });
                return nil;
            }];
        }];
    }
    return _refreshCommand;
}

2) Init VASRefreshControl for your UIScrollView and set RACCommand for execute during refresh:

self.refreshControl = [[VASRefreshControl alloc] initWithLoaderStyle:VASRefreshControlLoaderStyleBlue
                                                                         forScrollView:self.scrollView];
self.refreshControl.rac_command = self.refreshCommand;

項目主頁:http://www.baiduhome.net/lib/view/home/1436251856083

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!