FMTopReflesh 1.0.1

FMTopReflesh 1.0.1

测试已测试
语言语言 Obj-CObjective C
许可证 MIT
发布上次发布2018年1月

jacoli 维护。



  • jacoli

顶部刷新控制

为 scrollview/tableview 提供的一个简单的顶部刷新控件。

预览

Snapshot

安装

使用 CocoaPods,将此行添加到您的 Podfile 中。

pod 'FMTopReflesh'

然后运行 pod install,然后您就完成了!

或者把 FMTopRefleshControl.h FMTopRefleshControl.m 复制到您的项目。

如何使用

实现 FMTopRefleshControlTopView 协议

- (void)pullToReflesh {
    //self.backgroundColor = [UIColor blueColor];
    self.textLabel.text = @"pull to relfesh";
}

- (void)releaseToReflesh {
    //self.backgroundColor = [UIColor yellowColor];
    self.textLabel.text = @"release to relfesh";
}

- (void)startReflesh {
    //self.backgroundColor = [UIColor redColor];
    [self.indicator startAnimating];
    self.textLabel.text = @"relfesh...";
}

- (void)refleshFinished {
    //self.backgroundColor = [UIColor whiteColor];
    [self.indicator stopAnimating];
    self.textLabel.text = nil;
}

配置刷新控件

    self.refleshControl = [[FMTopRefleshControl alloc] initWithScrollView:v withRefleshCallback:^(FMTopRefleshControl *control) {
        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
            [control endReflesh];
        });
    } withTopView:[[CustomTopRefleshView alloc] initWithFrame:[UIScreen mainScreen].bounds]];

需求

  • iOS 7.0+
  • ARC