UIAlertController(ActionSheet)-无法同时满足约束 [英] UIAlertController (ActionSheet) - Unable to simultaneously satisfy constraints

查看:244
本文介绍了UIAlertController(ActionSheet)-无法同时满足约束的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每次在模拟手机中显示UIAlertController操作表时,我都会收到此警告。该代码没什么花哨的。

I'm getting this warning every time an UIAlertController action sheet is presented in a simulated phone. The code is nothing fancy.

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),Swift5。约束似乎超出了我的控制范围,但是请告知我是否做错了事。

I'm running Xcode 10.2 (10E125), Swift 5. The constraint seems out of my control but please advise if I'm doing something wrong.

推荐答案

IB的屏幕快照,显示用于约束操作菜单的图标。您也可以单击约束本身来编辑或删除约束。

Screenshot of IB showing the icons for constraint-manipulating menus. You can also click on the constraints themselves to edit or delete them.

查看各种下拉菜单。

这篇关于UIAlertController(ActionSheet)-无法同时满足约束的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆