ios - 显示带有延迟标题和消息的 actionSheet 样式的警报
问题描述
从 iOS 13 开始,我的带有 actionSheet 样式的警报以“延迟”的标题和消息显示。
这些是 Apple 的发行说明。
我已经研究了很多,但找不到如何让它像 iOS 13.1 之前那样工作,在 iOS 13.1 之前,标题和消息是在操作按钮的同时呈现的。
这是创建警报并显示它的方法:
private func showRemoveConfirmationAlert() {
let alert = UIAlertController(
title: "Remove device?".localized(),
message: "Are sure you want to remove this device from your account?\nMake sure to unpair your device before removing it. This action cannot be undone.".localized(),
preferredStyle: .actionSheet
)
alert.addAction(UIAlertAction(title: "Remove".localized(), style: .destructive, handler: { _ in
AnalyticsHelper.logRemoveDeviceConfirmedTapped()
self.viewModel?.removeFromAccount()
}))
alert.addAction(UIAlertAction(title: "Cancel".localized(), style: .cancel, handler: { _ in
AnalyticsHelper.logCancelTapped()
}))
if let popoverController = alert.popoverPresentationController {
popoverController.sourceView = self.view
}
self.present(alert, animated: true)
}
这就是它的样子:
任何帮助,将不胜感激!提前致谢。
解决方案
这是从 iOS 13 开始的默认行为。如果要立即渲染,请将动画更改为 false
self.present(alert, animated: false, completion : nil)
推荐阅读
- ios - 用户在 Firebase 上使用 Google 登录后,如何在 swiftUI 中重新呈现我的视图?
- android-studio - 更新 Android Studio 时出现 Flutter 错误,Kotlin、Flutter、Dart 插件与新的 Android Studio 4.0 版本不兼容
- css - 如何制作可以在鼠标悬停时单独更改大小的导航栏?
- c# - 达到最大连接限制时如何更改 http.sys Web 服务器响应
- c# - 具有无限循环和 thread.sleep 高 CPU 使用率的多个线程
- flask - 我在理解 Flask 中的 UserMixin 时遇到问题
- r - R中的.Rnw文件和块的问题
- mysql - Ubuntu 18.04 部署 zabbix4.0 时,数据库类型是 PostgreSQL 而不是 MySQL。如何设置它以支持 MySQL?
- c# - 为什么添加 Mesh Collider 会使 Inverse Kinematic 腿打乱他们的运动?
- python - 即使我设置种子变量,为什么 TensorFlow 会产生不同的输出?