如何在模态视图演示文稿中添加动画延迟Swift IOS


@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)
    }
}

最新更新