UIView animation seemingly affecting UICollectionViewCell

39 Views Asked by At

I have a UICollectionView (backed by IGListKit), and a UIViewAnimation block that animates some text in a custom navbar (a plain UIView, not a UINavigationBar) when the UICollectionView is scrolled beyond a certain point. The animation however seems to be affect the layout of the UICollectionViewCell - it seems to have the right height set but it's doing a transform animation, see video.

If I remove the animation, the cell behaves just fine.

I'm pretty confused as the two don't seem related at all. Does anyone have any idea what's happening here?

https://i.imgur.com/G6jnfSl.mp4

Animation function for the navbar

    func showTitle(_ isShowing: Bool) {
        guard isShowingTitle != isShowing else { return }
        UIView.animate(withDuration: 0.2) {[weak self] in
            guard let self = self else { return }
            self.breadcrumb.font = isShowing ? BaseNavBar.subtitleFont : BaseNavBar.titleFont
            self.breadcrumb.textColor = isShowing ? Color.fontSecondary : Color.fontPrimary
            self.mainTitle.alpha = isShowing ? 1 : 0
            self.mainTitle.isHidden = !isShowing
        }
        isShowingTitle = isShowing
    }
0

There are 0 best solutions below