美文网首页
我是如何不用UITableView 的悬浮title 类似微信的

我是如何不用UITableView 的悬浮title 类似微信的

作者: BillZhang88 | 来源:发表于2019-08-13 17:54 被阅读0次

在做朋友圈功能时,遇到这样的一个需求,需要用到 UITableView的悬停效果但是样式不能一样,怎么办呢?

sectionHeader 中动态改变Header 的内容,

funcscrollViewDidScroll(_scrollView:UIScrollView) { 

        letpoint =  scrollView.panGestureRecognizer.velocity(in:self.view)

        let  offsetY = scrollView.contentOffset.y;

        iflet  header =self.tempSectionView{

            letorigin = header.superview?.convert(header.origin, to:UIApplication.shared.keyWindow)

           letrealHeight  =  origin?.y??0- offsetY

            varbool =true

            if(point.y>0){

                //向上滚动

                bool =true

            }else{

                // 向下滚动

                bool =false

            }

            if(realHeight <80  &&  realHeight >0){

                // 向下滑

                if!bool{

                    if  self.currSection< (self.m_yearData.count-1) {

                        self.currSection+=1

                    }

                    self.m_YearLabel.text = self.m_yearData[self.currSection]

                }else{

                    // 向上滑

                    ifself.currSection!=0{

                        self.currSection-=1

                    }

                    self.m_YearLabel.text = self.m_yearData[self.currSection]

                }

            }else{

            }

        }

相关文章

网友评论

      本文标题:我是如何不用UITableView 的悬浮title 类似微信的

      本文链接:https://www.haomeiwen.com/subject/zbwbjctx.html