这些是苹果的release notes。
[我已经进行了很多研究,但是找不到如何使其像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)
尝试此方式:
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)
}
我认为此问题可能是由于.localized()
造成的