AnimatedCollectionViewLayout icon indicating copy to clipboard operation
AnimatedCollectionViewLayout copied to clipboard

Blinking parallax on iPhone 8 plus

Open Streetmage opened this issue 4 years ago • 2 comments

There is a problem scrolling 1-st and 2-nd pages. Pages are blinking during slow scrolling. For pages number higher than 3 it works fine. Reproduced on iPhone 8 plus so far for example app.

https://monosnap.com/file/nZNyO1yi7bhA7p9peXotsrxKNqKexJ

Streetmage avatar Feb 27 '20 14:02 Streetmage

Seems like replacing

if direction == .horizontal {
            let width = collectionView.frame.width
            let transitionX = -(width * speed * position)
            let transform = CGAffineTransform(translationX: transitionX, y: 0)
            let newFrame = attributes.bounds.applying(transform)
            
            contentView.frame = newFrame
        }

with

if direction == .horizontal {
            let width = collectionView.frame.width
            let transitionX = -(width * speed * position)
            var newFrame = attributes.bounds
            newFrame.origin.x = transitionX
            contentView.frame = newFrame
        }

solves the problem

Streetmage avatar Feb 27 '20 15:02 Streetmage

Wow, nice finding. Ideally the applying method should work exactly the same as setting the origin ourselves. Feels like a UIKit bug or something.

KelvinJin avatar Mar 02 '20 02:03 KelvinJin