Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/98.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 使用动画Swift 5取消默认卡片演示(.automatic)_Ios_Swift - Fatal编程技术网

Ios 使用动画Swift 5取消默认卡片演示(.automatic)

Ios 使用动画Swift 5取消默认卡片演示(.automatic),ios,swift,Ios,Swift,在使用iOS 13的应用程序中,有一个选项,可将ViewController显示为屏幕上显示的卡,或.automatic,可通过刷卡取消。不过,添加取消按钮可能会关闭页面,但不包括关闭卡的动画。有没有一种方法可以通过编程方式添加此内容 这是我的代码,当前正在使应用程序崩溃: @IBAction func cancel(_ sender: Any) { let detailVC = home() present(detailVC, animate

在使用iOS 13的应用程序中,有一个选项,可将ViewController显示为屏幕上显示的卡,或.automatic,可通过刷卡取消。不过,添加取消按钮可能会关闭页面,但不包括关闭卡的动画。有没有一种方法可以通过编程方式添加此内容

这是我的代码,当前正在使应用程序崩溃:

 @IBAction func cancel(_ sender: Any) {
        
        let detailVC = home()
        present(detailVC, animated: true)
        
    }
如果我只是在一个按钮上添加一个序列,动画就是弹出的页面,而不是像你在刷卡一样被忽略。谢谢大家!

我想你想要这个:

@IBAction func cancel(_ sender: Any) {
    dismiss(animated: true, completion: nil)       
}
你所做的是阻止一个新的vc在一个已经呈现的模式上。 您实际想要的是取消当前呈现的模式

见: