uitableview contentInset issue

前端 未结 2 999
庸人自扰
庸人自扰 2021-02-15 10:36

I have strange issue with contentInsent. I am implementing \"Pull & release\" to refresh on UITableView and everything works fine, but in some cases I would lik

相关标签:
2条回答
  • 2021-02-15 11:02

    this gives better results:

    CGFloat offset = scrollView.contentOffset.y;
    scrollView.contentInset = UIEdgeInsetsMake(60.0f, 0.0f, 0.0f, 0.0f);
    scrollView.contentOffset = CGPointMake(0, offset);
    
    0 讨论(0)
  • 2021-02-15 11:21

    OK, so I found the answer by playing a bit with different values. Turnes out that in the case described above besides setting contentInset you have to also setup contentOffset. In my case the following code worked:

    scrollView.contentInset = UIEdgeInsetsMake(60.0f, 0.0f, 0.0f, 0.0f);    
    scrollView.contentOffset = CGPointMake(0.0f, -60.0f);
    
    0 讨论(0)
提交回复
热议问题