BeatsKitano / KafkaRefresh

Animated, customizable, and flexible pull-to-refresh framework for faster and easier iOS development.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

scroll bounds 异常

SpectatorNan opened this issue · comments

提交bug前:

  • 请定位该bug是否由自身代码引发,当该bug模糊不清时,您应该继续思索;
  • 如果您发现该bug由KafkaRefresh引发,且您能修改源码解决,欢迎您提交解决方案或提交一个request,在此先表示感谢。

提交bug必须包含下列要点:

  • iOS版本;12.2
  • KafkaRefresh版本(可查看cocoapods中提示的版本信息); 1.4.0
  • 请您务必给出详细的重现步骤。

image
image
image

uiscrollview 顶部贴着屏幕, 添加headerControl ,顶部会被占用45 的高度,contentview的frame通过reveal查看 x y 均为 0,headerControl 的frame为 0,-45,375,45。 代码如上。 可判断这个空白不是 scroll 自动调整高度的64

image

是被遮挡还是什么,origin=0,-45 有问题?

image
上图是预期的样子
image
实际上出现顶部留白 意思是 下拉之后没有弹回去,顶部留有一个45高度的空白,

本地测试没有重现

- (void)viewDidLoad {
    [super viewDidLoad];
    
    if (@available(iOS 11, *)) {
        self.scrollView.contentInsetAdjustmentBehavior = UIApplicationBackgroundFetchIntervalNever;
    } else {
        self.automaticallyAdjustsScrollViewInsets = false;
    } 
    [self.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:(UIBarMetricsDefault)];
    
    [self.view addSubview:self.scrollView];
    self.scrollView.backgroundColor = [UIColor whiteColor];
    self.scrollView.frame = CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height);
    self.scrollView.contentSize = CGSizeMake(self.view.bounds.size.width, self.view.bounds.size.height*1.5);
    UIView *contentView = [UIView new];
    contentView.frame = CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height*1.5);
    contentView.backgroundColor = [UIColor blueColor];
    [self.scrollView addSubview:contentView];
    
    KafkaRefreshHandler headBlock = ^(void){
        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
            [self.scrollView.headRefreshControl endRefreshing];
        });
    };
    
    [self.scrollView bindHeadRefreshHandler:headBlock themeColor:[UIColor redColor] refreshStyle:_style];
}

- (UIScrollView *)scrollView {
    if (!_scrollView) {
        _scrollView = [UIScrollView new];
    }
    return _scrollView;
}

貌似找到原因了。我的刷新动画是通过rx绑定的

image
public var isAnimating: Binder {
return Binder(self.base) { refreshControl, active in
if active {
refreshControl.beginRefreshing()
} else {
refreshControl.endRefreshing()
}
}
}

image
使用普通方式结束刷新正常

可能是在数据绑定的时候产生了什么影响, 导致headrefresh暴露出来了,将原本的view给顶下来,从而产生了空白。

安好!