-1

Horizontal Scroll in UICollectionView when i scroll left or right the cell not position right ? For each index item i can see the next item coming at the edge and scrolling further more of next cell is coming out to the current index. I want to show only the current index item in scroll. I dont know if its a layout issue ? Any help would be really helpfull. I set my collection view minimum spacing to 0.

enter image description here

dahiya_boy
  • 9,298
  • 1
  • 30
  • 51
Vignesh Krish
  • 21
  • 1
  • 7

1 Answers1

1

You can add this code.also make sure to add UICollectionViewDelegateFlowLayout

  func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {

        return CGSize(width: yourCollectionView.bounds.width, height: yourCollectionView.bounds.height)
    }