欢迎光临
我们一直在努力

下拉刷新和无线滚动功能

建站超值云服务器,限时71元/月

下拉刷新和无线滚动功能

项目介绍:

项目简介

INSPullToRefresh

INSPullToRefresh是一个便于使用的非常简单的下拉刷新和无线滚动功能的UIScrollView集合。




使用方法

Objective-C

[self.tableView ins_addPullToRefreshWithHeight:60.0 handler:^(UIScrollView *scrollView) {

int64_t delayInSeconds = 1;
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC);
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
    [scrollView ins_endPullToRefresh];

});

}];

CGRect defaultFrame = CGRectMake(0, 0, 24, 24);

UIView <INSPullToRefreshBackgroundViewDelegate> *pullToRefresh = [[INSDefaultPullToRefresh alloc] initWithFrame:defaultFrame backImage:[UIImage imageNamed:@”circleLight”] frontImage:[UIImage imageNamed:@”circleDark”]];

self.tableView.ins_pullToRefreshBackgroundView.delegate = pullToRefresh;
[self.tableView.ins_pullToRefreshBackgroundView addSubview:pullToRefresh];
Swift

self.tableView.ins_addPullToRefreshWithHeight(60.0, handler: { scrollView in

let delayInSeconds: Int64 = 1
let popTime: dispatch_time_t = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * Int64(NSEC_PER_SEC));

dispatch_after(popTime, dispatch_get_main_queue()) {
    scrollView.ins_endPullToRefresh()
}

let defaultFrame = CGRectMake(0, 0, 24, 24)
let pullToRefresh = INSDefaultPullToRefresh(frame: defaultFrame, backImage: UIImage(named: "default_child"), frontImage: UIImage(named: "default_user"))

self.tableView.ins_pullToRefreshBackgroundView.delegate = pullToRefresh
self.tableView.ins_pullToRefreshBackgroundView.addSubview(pullToRefresh)

})

需要在自定义视图中处理INSPullToRefreshBackgroundViewDelegate方法

@protocol INSPullToRefreshBackgroundViewDelegate <NSObject>
@optional

  • (void)pullToRefreshBackgroundView:(INSPullToRefreshBackgroundView *)pullToRefreshBackgroundView didChangeState:(INSPullToRefreshBackgroundViewState)state;

  • (void)pullToRefreshBackgroundView:(INSPullToRefreshBackgroundView *)pullToRefreshBackgroundView didChangeTriggerStateProgress:(CGFloat)progress;

@end

github地址:https://github.com/inspace-io/INSPullToRefresh

code4app

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » 下拉刷新和无线滚动功能
分享到: 更多 (0)