ios - 通用 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)
解决方案
推荐阅读
- insert - 通过 Dafny 实现堆插入(带规范)
- python - 如何使用 PonyORM 动态创建实体?
- flutter - Flutter - 如何在 TabBarView 的主体内导航?
- android - 如何创建可访问的 PrivateKeys?
- julia - Julia函数将秒转换为小时、分钟、秒的问题
- javascript - Next.js Router.push 没有设置任何 req.headers
- azure - CI/CD 时无法在 Azure 上复制文件和文件夹
- c++ - 为单个函数一次声明多个变量的最佳方法是什么?
- html - 在不同大小的网格中移动按钮
- react-native - 修改index.js后黑屏