【发布时间】:2020-01-11 22:56:39
【问题描述】:
我遇到了以下问题。 我设置了操作表的背景颜色。 对于 iPhone,一切正常,但 iPad 版本显示一个没有任何文本的警报(警报完全用我设置的颜色填充)。 是苹果虫还是我做错了什么?
@IBAction func save(_ sender: UIButton) {
let alert = UIAlertController(title: nil, message: "Error", preferredStyle: .actionSheet)
alert.view.tintColor = .black
alert.popoverPresentationController?.sourceView = self.view
alert.popoverPresentationController?.sourceRect = CGRect(x: self.view.bounds.midX, y: self.view.bounds.midY, width: 0, height: 0)
self.present(alert, animated: true)
}
【问题讨论】:
-
"alert 完全用我设置的颜色填充" 但在您实际展示给我们的任何代码中都没有。
-
嗯,我在截图之前贴了代码,还是我误解了你?
标签: ios swift iphone ipad actionsheet