【发布时间】:2018-11-06 00:15:56
【问题描述】:
我正在尝试淡入背景渐变图像并将uiview 卡片从底部(屏幕外)滑到uiviewcontroller 的中心 - 当uiviewcontroller 出现时同时执行两个动画模态的。
我尝试将uiviewcontroller 模态过渡样式设置为交叉溶解,这将为背景渐变图像提供淡入效果,并在viewDidAppear 中运行动画以向上滑动@987654326 @card 从底部到中心。
虽然这可行,但卡有一点延迟,理想情况下我希望两个动画同时发生。
可以这样分组吗?任何指导将不胜感激。
以下是模态呈现的视图控制器中的相关代码:
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
alertViewCenterYConstraint.constant += view.bounds.height
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
UIView.animate(withDuration: 0.1, delay: 0, options: .curveEaseOut, animations: {
self.alertViewCenterYConstraint.constant = 0
self.view.layoutIfNeeded()
}, completion: nil)
}
【问题讨论】:
标签: ios swift uiviewanimation presentmodalviewcontroller