首页 > 解决方案 > UIView.transition 显示具有深色背景的父视图(Swift)

问题描述

翻转时,父视图淡入黑色(从白色)到动画中间,然后再次淡入白色......为什么?

我的代码:

    if !cardFrontView.isHidden {
        let transitionOptions: UIViewAnimationOptions = [.transitionFlipFromRight, .showHideTransitionViews]
        UIView.transition(from: cardFrontView, to: cardBackView, duration: 1.0, options: transitionOptions, completion: nil)
    }
    else {
        let transitionOptions: UIViewAnimationOptions = [.transitionFlipFromLeft, .showHideTransitionViews]
        UIView.transition(from: cardBackView, to: cardFrontView, duration: 1.0, options: transitionOptions, completion: nil)
    }

我也试过UIView.transition(with:但我还有另一个问题:圆角正在消失。

整天为此苦苦挣扎......我的意思是这就是所有的代码。

1 2 3 4

标签: iosswiftuiviewflip

解决方案


尝试将 BaseView Color 设置为UIColor.clearinstaed ofUIColor.white


推荐阅读