快速的UIView过渡不会翻转视图

时间:2019-10-14 23:15:55

标签: ios swift uiviewanimation

UIView.transition不适用于将视图作为子视图

我有以下简单设置:

func flipYellowSubView(imageView: UIImageView) {
        let yellowSubView = UIView(frame: imageView.frame)
        yellowSubView.backgroundColor = .yellow
        imageView.addSubview(yellowSubView)
        UIView.transition(with: yellowSubView, duration: 0.5, options: [.transitionFlipFromBottom], animations: {
        }, completion: { (finished: Bool) in
            if finished {
                yellowSubView.removeFromSuperview()
            }
        })
    }

因此,如果我将imageView传递给flipYellowSubView,我希望将yellowSubview添加,翻转然后删除。

发生的事情是添加和删除了flipYellowSubView,但是没有发生翻转。

0 个答案:

没有答案