【发布时间】:2019-03-28 19:33:01
【问题描述】:
每次在模拟手机中显示 UIAlertController 操作表时,我都会收到此警告。代码没什么花哨的。
let action1 = UIAlertAction(title: "Action 1", style: .default) { _ in }
let action2 = UIAlertAction(title: "Action 2", style: .default) { _ in }
let cancel = UIAlertAction(title: "Cancel", style: .cancel, handler: nil)
let alert = UIAlertController(title: "title", message: "message", preferredStyle: .actionSheet)
alert.addAction(action1)
alert.addAction(action2)
alert.addAction(cancel)
self.present(alert, animated: true)
我正在运行 Xcode 10.2 (10E125),Swift 5。约束似乎超出了我的控制,但如果我做错了什么,请告知。
【问题讨论】:
-
您是否尝试过“重置为建议的约束”?似乎有多个 view.width 约束。
-
我在哪里可以找到它?我不认为它是 UIAlertController 实例上的一个选项。
-
IB的右下角。请参阅我的答案中的屏幕截图。它位于底部最左侧图标的菜单中。而且,为了记录,我同意 IB 在你学习的时候似乎做了一些奇怪的事情。
-
答案应该是了。希望对你有帮助。
-
显然这是 Apple 的错误。让我们合并这些重复的问题。请提交错误报告。
标签: swift constraints