如何在Swift中添加关闭模式的按钮
我正在使用Swift中的如何在Swift中添加关闭模式的按钮,swift,Swift,我正在使用Swift中的present显示一个模式,我想在它的左上角添加一个按钮,这样我就可以通过按下它来关闭模式。我该怎么做 @IBAction func touchCreateEvent(_ sender: UIButton) { self.present(HomeViewController(), animated: true, completion: nil) } 这是我显示模态的地方。我想要该按钮,因为在以前的iOS版本中,我们没有向下滑动动画来关闭模式。在iAction内部
present
显示一个模式,我想在它的左上角添加一个按钮,这样我就可以通过按下它来关闭模式。我该怎么做
@IBAction func touchCreateEvent(_ sender: UIButton) {
self.present(HomeViewController(), animated: true, completion: nil)
}
这是我显示模态的地方。我想要该按钮,因为在以前的iOS版本中,我们没有向下滑动动画来关闭模式。在iAction内部的HomeViewController中,请执行以下操作:
@IBAction func buttonAction(_ sender: UIButton) {
self.dismiss(animated: true, completion: nil)
}