如何在swift中更新当前alertview标题?

如何在swift中更新当前alertview标题?,swift,uialertview,viewcontroller,Swift,Uialertview,Viewcontroller,我使用“UIAlertController”和“presentViewController”来显示alertview,如下所示 let deviceName = bleManager.activePeripheral?.name let alert = UIAlertController(title: "Connecting...", message: deviceName, preferredStyle: UIAlertControllerStyle.Alert

我使用“UIAlertController”和“presentViewController”来显示alertview,如下所示

        let deviceName = bleManager.activePeripheral?.name
        let alert = UIAlertController(title: "Connecting...", message: deviceName, preferredStyle: UIAlertControllerStyle.Alert)
        presentViewController(alert, animated: true, completion: nil)
现在我想将当前标题从“连接”更新为“搜索”,但alertview无法关闭


如何做到这一点?

您可以将警报对象存储在属性中,并在需要时访问和更新它


这包括更改标题或添加操作。

您可以将警报对象存储在属性中,并在需要时访问和更新它

这包括更改标题或添加操作