xcode CollectionViewController scrollToItemAtIndexPath not working

前端 未结 9 821
故里飘歌
故里飘歌 2021-02-01 03:06

I have created a CollectionView Control and filled it with images. Now I want to scroll to item at a particular index on start. I have tried out scrollToItemA

9条回答
  •  一个人的身影
    2021-02-01 03:34

    Swift 3

    UIView.animate(withDuration: 0.4, animations: {
        myCollectionview.scrollToItem(at: myIndexPath, at: .centeredHorizontally, animated: false)
    }, completion: {
        (value: Bool) in
        // put your completion stuff here
    })
    

提交回复
热议问题