Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scroll bounds 异常 #54

Closed
SpectatorNan opened this issue May 2, 2019 · 6 comments
Closed

scroll bounds 异常 #54

SpectatorNan opened this issue May 2, 2019 · 6 comments

Comments

@SpectatorNan
Copy link

提交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

@BeatsKitano
Copy link
Owner

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

@SpectatorNan
Copy link
Author

SpectatorNan commented May 3, 2019

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

@BeatsKitano
Copy link
Owner

本地测试没有重现

- (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;
}

@SpectatorNan
Copy link
Author

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

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

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

@SpectatorNan
Copy link
Author

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

@BeatsKitano
Copy link
Owner

安好!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants