简体   繁体   English

故事板界面构建器约束的含义是什么

[英]What colors mean on storyboard interface builder constraints

I have constraints on the storyboard with different colors, and just want to know what they all mean, and what the errors are. 我对故事板有不同颜色的限制,只想知道它们的含义,以及错误是什么。 Eg: 例如:

在此输入图像描述

I found out the following on developer.apple.com : 我在developer.apple.com上发现了以下内容:

红色

Red: Interface Builder uses red constraint lines to identify conflicting constraints. 红色:Interface Builder使用红色约束线来识别冲突的约束。 橙子

Orange: Interface Builder uses orange lines to identify either a misplaced item or an item with missing constraints. 橙色:Interface Builder使用橙色线来标识错放的项目或缺少约束的项目。

在此输入图像描述

Blue: Constraints are ok, and not in error or conflicting 蓝色:约束条件正常,没有错误或冲突

Yes you are correct, just adding some more details, that might be helpful 是的,你是对的,只是添加一些可能有用的细节

  • Yellow - Warning 黄色 - 警告
  • Red - Error 红色 - 错误
  • Blue - Correct 蓝色 - 正确

In case of Autolayout constraints when you get these this means, 如果你得到这些意味着Autolayout约束,

  • Yellow - Your constraints may change in runtime, or can affect your layout, its shows due lack of all proper constraints that supports others, but can run without it. 黄色 - 您的约束可能会在运行时发生变化,或者可能会影响您的布局,其显示由于缺乏支持其他人的所有适当约束,但可以在没有它的情况下运行。 You can live with it, if it really doesn't affect your layout. 如果它真的不影响你的布局,你可以忍受它。 Though Xcode does suggest what could be affecting, like in image below 虽然Xcode确实提出了可能影响的内容,如下图所示

在此输入图像描述

在此输入图像描述

  • Red - It comes when you miss any layout that is absolute necessary, your app will crash if you run with error in Autolayout. 红色 - 当您错过任何绝对必要的布局时,如果您在Autolayout中运行错误,您的应用程序将崩溃。 Though you might find our the cause of error,or missing constraint. 虽然您可能会发现错误原因或缺少约束。 In this case too Xcode too suggest you to add missing constraints automatically. 在这种情况下,Xcode也建议您自动添加缺失的约束。 See images below what Xcode suggests 请参阅下面的图片Xcode建议的内容

I hope this is helpful. 我希望这是有帮助的。

Thanks. 谢谢。

在此输入图像描述 在此输入图像描述

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

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