Dynamically setting layout on UICollectionView causes inexplicable contentOffset change

前端 未结 10 1620
一生所求
一生所求 2020-11-29 16:10

According to Apple\'s documentation (and touted at WWDC 2012), it is possible to set the layout on UICollectionView dynamically and even animate the changes:

10条回答
  •  离开以前
    2020-11-29 16:35

    This finally worked for me (Swift 3)

    self.collectionView.collectionViewLayout = UICollectionViewFlowLayout()
    self.collectionView.setContentOffset(CGPoint(x: 0, y: -118), animated: true)
    

提交回复
热议问题