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,但是没有发生翻转。