ios - 将加载动画放在 VNDocumentViewController Swift
问题描述
是否可以在 VNDocumentViewController 上放置加载动画?例如,当用户按下Save
按钮时,有没有办法让我以某种方式表明Vision
正在处理图像并且没有冻结?现在,在我的应用程序中,用户按下保存和正在处理的实际图像之间有很长的停顿。这是我正在尝试创建的另一篇文章的示例
解决方案
这是一个使用 UIActivityIndicatorView() 添加加载指示器的示例。
startAnimating() 开始动画, stopAnimation() 停止动画。
guard let topWindow = UIApplication.shared.windows.last else {return}
let overlayView = UIView(frame: topWindow.bounds)
overlayView.backgroundColor = UIColor.clear
topWindow.addSubview(overlayView)
let hudView = UIActivityIndicatorView()
hudView.bounds = CGRect(x: 0, y: 0, width: 20, height: 20)
overlayView.addSubview(hudView)
hudView.center = overlayView.center
hudView.startAnimating()
或者,您可以考虑使用 Cocoapod MBProgressHud
推荐阅读
- c# - ValueTuple 对于大型对象有多好?
- azure - 获取安全中心在 azure vm 上进行威胁检测的电子邮件警报
- python-2.7 - 使用 python docx 按部分交叉引用的图形编号
- python - “无法连接到 HTTPS URL,因为 SSL 模块不可用。”
- java - 无法从硒中的输入元素获取文本
- python - 如何使用 Keras 在 Python 中创建具有动态输出的 LSTM 模型?
- c++builder-6 - 我无法将数据上传到 VirtualStringTree
- javascript - 有什么办法可以隐藏子弹
- 具有空 div 的元素
- php - PHP OOP 从 PHP5.6 迁移到 7.2 后,mysql INSERT 查询不再起作用
- android - 无法在 Play 商店中查看内部/Alpha 应用列表