I want to build a top parallax that the image grows as you go down with the scroll collectionView of the screen.
I'm using a CustomLayoutAttributes to get the attribute and increase it.
Example:
private func updateCells(_ attributes: CustomLayoutAttributes,
halfHeight: CGFloat,
halfCellHeight: CGFloat) {
let cellDistanceFromCenter = attributes.center.y - contentOffset.y - halfHeight
let parallaxOffset = -(settings.maxParallaxOffset * cellDistanceFromCenter)
(halfHeight + halfCellHeight)
let boundedParallaxOffset = min(
max(-settings.maxParallaxOffset, parallaxOffset),
settings.maxParallaxOffset)
attributes.parallax = CGAffineTransform(translationX: 0, y:
boundedParallaxOffset)
In addition to that, you have few subviews on the cell. My problem is, every time I increase the cell the subviews grow up with the cell.
How do I make the cell grow but the subviews inside not grow???
This is a reference to a project:
https://www.raywenderlich.com/527-custom-uicollectionviewlayout-tutorial-with-parallax
Thanks