上拉以使用uiview重新加载到collectionview中

时间:2018-07-14 06:04:31

标签: ios swift uicollectionview

我有一个用于显示评论的集合视图,我在视图控制器的底部使用了一个uiview,高度为0。 当用户到达收藏夹视图中的内容底部时,当他拉出过去的内容时,我会在scrollviewdidscroll中签入

func scrollViewDidScroll(_ scrollView: UIScrollView) {
        if self.comment.count >= 5 {
            let  offseety = scrollView.contentOffset.y
            let contenthight = scrollView.contentSize.height
            if offseety > contenthight - scrollView.frame.size.height + 5 && offseety > 50{
                if self.viewheight.constant < 50 {
                    self.viewheight.constant =  scrollView.frame.size.height - contenthight + offseety
                    if offseety > contenthight - scrollView.frame.size.height + 50{

                        self.anddiii.isHidden = false
                        self.anddiii.startAnimating()
                        self.anothershit.isHidden = false
                        self.anothershit.text =  "Loading more"
                    }
                }}else{

            }
        }
    }

但是在滚动结束后,收藏夹视图向后滚动的问题是,有没有办法在下面的收藏夹单元格中放置一个偏移量显示uiview的

1 个答案:

答案 0 :(得分:0)

尝试以下代码:

self.collectionView.contentInset = UIEdgeInsetsMake(0,0,55,0)