当我同时移动并隐藏该视图时,我需要UIVisualEffectView动画:
@objc func handleTap(_ sender: UITapGestureRecognizer? = nil) {
if (!open) {
self.bottomConstraint.constant = 200
UIView.animate(withDuration: 2, delay: 0, usingSpringWithDamping: 1.5, initialSpringVelocity: 2, options: .curveEaseInOut, animations: {
self.playerView.effect = nil
self.view.layoutIfNeeded()
})
}
else {
self.bottomConstraint.constant = 10
UIView.animate(withDuration: 2, delay: 0, usingSpringWithDamping: 1.5,
initialSpringVelocity: 2, options: .curveEaseInOut, animations: {
self.view.layoutIfNeeded()
self.playerView.effect = UIBlurEffect(style: .light)
}, completion: { (finished: Bool) in
})
}
open = !open
}
}
但是在动画结束时,我看到一些奇怪的线在闪烁。您能帮我解决此问题,还是找到其他解决方案?谢谢你马丁