@objc func popCartView(tapGestureRecognizer: UITapGestureRecognizer)
{
    let modalViewController = CartViewController()
    modalViewController.modalPresentationStyle = .overCurrentContext
    self.present(modalViewController, animated: true, completion: nil)
}

如何使此视图的动画时间更长(大约2秒)以完成动画

最佳答案

@objc func popCartView(tapGestureRecognizer: UITapGestureRecognizer)
{
    let modalViewController = CartViewController()
    modalViewController.modalPresentationStyle = .overCurrentContext
    DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
        // Your code with delay
        self.present(modalViewController, animated: true, completion: nil)
    }
}

关于ios - 如何在Modal View演示文稿Swift iOS中添加动画延迟,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/48861349/

10-10 23:25