📜  如何在快速代码示例中进行触摸时关闭视图

📅  最后修改于: 2022-03-11 15:00:58.634000             🧑  作者: Mango

代码示例1
override func touchesBegan(_ touches: Set, with event: UIEvent?)
    {
        let touch = touches.first
        if touch?.view != self.yourView
        { self.dismiss(animated: true, completion: nil) }
    }