简体   繁体   English

无法同时满足约束-自动布局

[英]Unable to simultaneously satisfy constraints - Autolayout

I am using auto layout in my project. 我在项目中使用自动布局。 After adding some constraints and running the app, i see "Unable to simultaneously satisfy constraints" in the Xcode console. 添加一些约束并运行该应用程序后,我在Xcode控制台中看到“无法同时满足约束”。 Though my app design works as expected in the device. 虽然我的应用程序设计在设备中按预期工作。

So is it necessary to satisfy the constraints even though the app is working fine? 因此,即使应用程序运行正常,是否也需要满足约束条件?

Thanks. 谢谢。

The goal of autolayout is to use minimum possible constraints to satisfy the autolayout rules. 自动布局的目标是使用最小可能的约束来满足自动布局规则。 Though some constraints are satisfied with respect to some particular views but it may be conflicting with respect to whole view. 尽管对于某些特定视图满足了一些约束,但是对于整体视图却可能会产生冲突。

It is not necesarry, but besides warnings and inconsistancy you could have a problem with your layout later. 它不是必需品,但除了警告和不一致之外,以后您的布局可能还会有问题。

Try to add missing constraints like this in your story board: 尝试在故事板上添加缺少的约束,如下所示:

Editor > Resolve Auto Layout Issues > All Views in View Controller > Add Missing Constraints

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM