Hi, I’m experimenting with MessageKit and trying to implement gradient background messages using a UICollectionView.
See here for demonstration Example of video scrolling and animation.
My setup is that I placed a gradient as the background for UICollectionView, I give the cells that should have a gradient a clear background, and I use a mask on the gradient (collectionView background) which is a combination of the layer. each cell.
I’m updating the mask
scrollView(didScroll:), and it works fine, but the problem occurs when I have to update the mask when no scrolling has occurred (for example, when you select a cell, the frame changes with animation).
My first suspicion was that my logic took a long execution time, so I measured the runtime of my mask logic, and it was a maximum of about 0.00022 seconds, which is 1/80 of the screen refresh rate.
My second suspicion is that the devices used (CGFloat) lack some precision and cause the misalignment.
what may be the cause of such behavior, or what may be a better approach to achieve gradient effect. All help is highly appreciated.