首页 > 解决方案 > 通用 AlertViewController 适用于所有视图控制器

问题描述

我想要一个 AlertView 控制器创建一次,可以从所有控制器打开,也可以从无 UIKIT 类(不是从 UIviewController 继承的类,并且不导入 UIKIT 我需要优化方法)有人可以帮助我吗 谢谢提前

let alert = UIAlertController(title: "success" , message: "Image Uploaded Succesfully", preferredStyle: .alert)
    let alertOk = UIAlertAction(title: "OK", style: .default) { (action) in
        self.dismiss(animated: true, completion: nil)
    }
    alert.addAction(alertOk)
    present(alert, animated: true, completion: nil)

标签: iosswiftuikit

解决方案


推荐阅读