Search code examples
setuicollectionviewdefaultnsindexpath

UICollectionView Set First Opening index Number


I have an UICollectionView. This CollectionView opens to index number "0" but I want it to open to index number "2" . How do I make it?


Solution

  • scrollView.setContentOffset(CGPoint(x: 0, y: cellHeight * 2), animated: false)
    

    you can use this line in swift