Debugging Auto Layout

Types of Errors错误类型

Errors in Auto Layout can be divided into three main categories:自动布局中的错误可分为三大类:

  • Unsatisfiable Layouts. Your layout has no valid solution. For more information, see Unsatisfiable Layouts.永无止境的布局。您的布局没有有效的解决方案。更多信息,见永无止境的布局。
  • Ambiguous Layouts. Your layout has two or more possible solutions. For more information, see Ambiguous Layouts.暧昧的布局。您的布局有两个或多个可能的解决方案。有关更多信息,请参见。
  • Logical Errors. There is a bug in your layout logic. For more information, see Logical Errors.逻辑错误。在布局逻辑中有一个bug。有关更多信息,请参见逻辑错误。

Most of the time, the real problem is just determining what went wrong. You added the constraints you thought you needed, but when you ran the app, things did not turn out as you had hoped.

大多数时候,真正的问题只是决定出了什么问题。你添加了你认为需要的约束,但是当你运行应用程序时,事情并没有如你所希望的那样发展。

Usually, as soon as you understand the problem, the solution is obvious. Remove conflicting constraints, add missing constraints, and adjust tied priorities so that there is a clear winner. Of course, getting to the point where you can easily understand the problem may take some trial and error. Like any skill, it gets easier with practice.

通常,一旦你理解了这个问题,解决方法是显而易见的。删除冲突的约束,添加缺失的约束,并调整并列优先级,以便有一个明确的赢家。当然,到达一个点,你可以很容易地理解这个问题可能会采取一些尝试和错误。像任何技能,它变得更容易与实践。

Sometimes, however, things get more complicated. That’s where the Debugging Tricks and Tips chapter comes in.

然而,有时候事情变得更加复杂。这就是调试技巧和提示章节进来。

时间: 2025-01-02 00:36:38

Debugging Auto Layout的相关文章

debugging Auto Layout:Debugging Tricks and Tips

Debugging Tricks and Tips调试技巧和技巧 The following topics describe techniques for gathering and organizing information about your layout, as well as descriptions of some surprising behaviors you may encounter. You may not need to use these techniques on

Debugging Auto Layout:Ambiguous Layouts

Ambiguous Layouts 模棱两可的布局 Ambiguous layouts occur when the system of constraints has two or more valid solutions. There are two main causes:当约束系统有两个或多个有效解时,会出现不规则的布局.主要有两个原因: The layout needs additional constraints to uniquely specify the position an

debugging Auto Layout:Logical Errors

Logical Errors逻辑错误 Logical errors are simply bugs. Somewhere, you have an assumption that is faulty. Perhaps it's an assumption about how Auto Layout calculates the views' frames. Perhaps it's an assumption about the set of constraints that you've cr

Debugging Auto Layout:Unsatisfiable Layouts

Unsatisfiable Layouts永无止境的布局 Unsatisfiable layouts occur when the system cannot find a valid solution for the current set of constraints. Two or more required constraints conflict, because they cannot all be true at the same time. 永无止境的布局出现系统无法找到制约当前

Auto Layout Guide----(一)-----Understanding Auto Layout

Understanding Auto Layout 理解自动布局 Auto Layout dynamically calculates the size and position of all the views in your view hierarchy, based on constraints placed on those views. For example, you can constrain a button so that it is horizontally centered

WWDC2016 Session笔记 – Xcode 8 Auto Layout新特性

来源:一缕殇流化隐半边冰霜(@halfrost) 链接:http://t.cn/Rt7sKBv 目录 1.Incrementally Adopting Auto Layout 2.Design and Runtime Constraints 3.NSGridView 4.Layout Feedback Loop Debugging 一.Incrementally Adopting Auto Layout Incrementally Adopting Auto Layout是什么意思呢?在我们IB

iOS之Xcode8 Auto Layout新特性

目录 1.Incrementally Adopting Auto Layout 2.Design and Runtime Constraints 3.NSGridView 4.Layout Feedback Loop Debugging 一.Incrementally Adopting Auto Layout Incrementally Adopting Auto Layout是什么意思呢?在我们IB里面布局我们的View的时候,我们并不需要一次性就添加好所有的constraints.我们可以一

iOS Programming Introduction to Auto Layout 自动布局

iOS Programming Introduction to Auto Layout ? 自动布局 A single application that runs natively on both the iPad and the iPhone is called a universal application. 一个原生的能运行在iPad 和iPhone 的应用叫做universal application? Then select the Homepwner target in the pr

Auto Layout Guide----(三)-----Anatomy of a Constraint

Anatomy of a Constraint 剖析约束 The layout of your view hierarchy is defined as a series of linear equations. Each constraint represents a single equation. Your goal is to declare a series of equations that has one and only one possible solution. A samp