I'm working on a collection view that should look like this:
The scroll view works but I want to make my collection view peak the next item like in the screenshot, and when scrolling it scales the normal size of course.
I couldn't manage to do that with only enabling paging (of course).
Thank you all for any help!
Edit: This kinda helps what I want to achieve, but it still lacks scaling and does not work near good while scrolling.
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat {
return -100
}
CodePudding user response:
You can of course do this with collectionView or scrollview, however I recommend using some well made external library for this. Try looking at this Library You can also Install it with CocoaPods , looke here: cocoapods link I think it will serve you well.
If you want to do this entirely by yourself try taking advantage of this UICollectionViewDelegate
function with implementing CGAffineTransform
scaling :
func collectionView(_ collectionView: UICollectionView, willDisplay willDisplayCell: UICollectionViewCell, forItemAt forItemAtIndexPath: IndexPath) {
guard let cell = willDisplayCell as? YourCell else { return }
cell.transform = CGAffineTransform(scaleX: 2, y: 2)
}
CodePudding user response:
Using FSPagerView you can achieve this, it have different customized options.
CodePudding user response:
If you want to do all in one at go, please go Ui collection view delegate.function with implimenting CGAFFineTransform scaling.