search

Home  >  Q&A  >  body text

ios - tableview的sectionheader的悬停问题

我把一个选项卡view放在了sectionheader里面 也就实现了自带的悬停效果。 可是一滑倒处于悬停位置时候,下面黄色的指示条就回归到最初始位置。这个问题有人遇到过吗?

PHPzPHPz2892 days ago595

reply all(4)I'll reply

  • 怪我咯

    怪我咯2017-04-18 09:15:58

    Because the section view is regenerated every time, you need to record the position information of all indicator bars in the viewcontroller. Just set the yellow indicator bar every time you return the section view

    reply
    0
  • 黄舟

    黄舟2017-04-18 09:15:58

    // Remove UItableview headerview stickiness (sticky)

    - (void)scrollViewDidScroll:(UIScrollView *)scrollView  
    {  
        CGFloat sectionHeaderHeight = 40;  
        if (scrollView.contentOffset.y<=sectionHeaderHeight&&scrollView.contentOffset.y>=0) {  
            scrollView.contentInset = UIEdgeInsetsMake(-scrollView.contentOffset.y, 0, 0, 0);  
        }  
        else if (scrollView.contentOffset.y>=sectionHeaderHeight) {  
            scrollView.contentInset = UIEdgeInsetsMake(-sectionHeaderHeight, 0, 0, 0);  
        }  
    } 

    Try this

    reply
    0
  • PHPz

    PHPz2017-04-18 09:15:58

    See if the tableview is refreshed when sliding. If refreshed, the section header will be redrawn without reuse.

    reply
    0
  • PHPz

    PHPz2017-04-18 09:15:58

    Brother, what is your solution to this problem?

    reply
    0
  • Cancelreply