suchen

Heim  >  Fragen und Antworten  >  Hauptteil

ios - tableview的sectionheader的悬停问题

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

PHPzPHPz2893 Tage vor602

Antworte allen(4)Ich werde antworten

  • 怪我咯

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

    因为section的view每次都是重新生成的 所有指示条的位置信息你要记录在viewcontroller里 在每次return section view时设置黄色的指示条就OK了

    Antwort
    0
  • 黄舟

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

    // 去掉UItableview headerview黏性(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);  
        }  
    } 

    试试这个

    Antwort
    0
  • PHPz

    PHPz2017-04-18 09:15:58

    看看滑动的时候有没有刷新tableview。如果刷新了,sectionheader在没有重用的情况下会重新绘制。

    Antwort
    0
  • PHPz

    PHPz2017-04-18 09:15:58

    兄弟这个问题你的解决方案是什么?

    Antwort
    0
  • StornierenAntwort