我可以将开关添加到 UIAlertController 吗?

Can I add switch to UIAlertController?

我的代码UIAlertController call。我需要添加切换到警报视图。

let alertController = UIAlertController(title: "Поздравляем!", message: "Ваш комментарий сохранен! Если хотите изменить его, выключите и включите переключатель Комментария!", preferredStyle: UIAlertControllerStyle.alert)

let okAction = UIAlertAction(title: "Окей", style: .default) { (action) -> Void in
    let sb = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "mailVerify")
    self.present(sb, animated: true, completion: nil)
}

alertController.addAction(okAction)
self.present(alertController, animated: true, completion: nil)

一种可行的方法是创建带有开关的自定义 UIView 并以模态方式呈现它而不是 UIAlertController。或者试试这个