I\'m trying to create a UICollectionView where the UICollectionViewCell is getting scaled down when \"leaving\" the visible area at the top or bottom. And getting scaled up
Not a complete solution, but a few remarks/pointers:
You should not mess with the collection view cells directly in this way, but rather have a custom UICollectionViewLayout subclass that modifies the UICollectionViewLayoutAttributes to include the desired transform
and invalidating the layout whenever necessary.
Doing if pos.origin.y == 50
is definitely not a good idea, because the scrolling might not pass by all values (that is, it might jump from 45 to 53). So, use >=
and include some other way if you want to ensure that your animation is only executed once at the "boundary" (for example, store the last position or a flag).