I have an UICollecitonView. I need that my cell size to be equal as UICollectionView Frame size because of the paging, and I handled the spacing by trailing and leading space in UICollectionViewCell's content view, and the spacing of UICollectionView is actually zero. and I set the clipToBounds of UICollectionView to false.
When I use Debug View Hierarchy, the UICollectionView has two visible cells at the same time. But in my case I need at least 3 visible cells at the same time, Because I need to show the edge of previous cell and the next cell, like what you see in the image.
How can I do that?
func numberOfSections(in collectionView: UICollectionView) -> Int {
return 1
}
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
return collectionView.frame.size
}
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return self.data_array.count
}
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat {
return 0
}
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat {
return 0
}
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets {
return UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
}