Chapter 15 Introduction to Auto Layout
2014-09-24 17:44
253 查看
Chapter 15 Introduction to Auto Layout
1. You do not define a view’s alignment rectangle directly. You do not have enough information (screen size!)to do that. Instead, you provide a set of constraints. Taken together, these constraints allow the system to determine the layout attributes, and thus the alignment rectangle, for each view in the view hierarchy.
2. A constraint defines a specific relationship in a view hierarchy that can be used to determine a layout attribute for one or more views. For example, you might add a constraint like “the vertical space between these two views should always be 8 points” or “these views must always have the same width.” A constraint can apse be used to give a view a fixed size, like “this view’s height should always be 44 points.”
3. Each constraint has priority level that is used to determine which constraint wins when more than one constraint conflicts. A priority is a value from 1 to 1000, where 1000 is a required constraint. By default, constraints are required, so all of the constraints that you have added are required. This means that the priority level would not help if you had conflicting. Instead, Auto Layout would report an issue regarding unsatisfiable constraints. Typically, you find the constraints that conflict and then either remove one (often, the culprit is an obvious accident) or reduce the priority level of a constraint to resolve the conflict but keep all the constraints in play.
4. viewDidLayoutSubviews gets called any time the view changes in size (for example, when the device is rotated) or when it is first presented on the screen.
1. You do not define a view’s alignment rectangle directly. You do not have enough information (screen size!)to do that. Instead, you provide a set of constraints. Taken together, these constraints allow the system to determine the layout attributes, and thus the alignment rectangle, for each view in the view hierarchy.
2. A constraint defines a specific relationship in a view hierarchy that can be used to determine a layout attribute for one or more views. For example, you might add a constraint like “the vertical space between these two views should always be 8 points” or “these views must always have the same width.” A constraint can apse be used to give a view a fixed size, like “this view’s height should always be 44 points.”
3. Each constraint has priority level that is used to determine which constraint wins when more than one constraint conflicts. A priority is a value from 1 to 1000, where 1000 is a required constraint. By default, constraints are required, so all of the constraints that you have added are required. This means that the priority level would not help if you had conflicting. Instead, Auto Layout would report an issue regarding unsatisfiable constraints. Typically, you find the constraints that conflict and then either remove one (often, the culprit is an obvious accident) or reduce the priority level of a constraint to resolve the conflict but keep all the constraints in play.
4. viewDidLayoutSubviews gets called any time the view changes in size (for example, when the device is rotated) or when it is first presented on the screen.
相关文章推荐
- Introduction to Algorithm ( chapter 15: Dynamic Programming)
- Chapter 1:Introduction to objects
- The Definitive Guide to symfony | Chapter 15 - Unit And Functional Testing | symfony | Web PHP Framework
- Introduction to Algorithms (算法导论) 学习笔记 -- Chapter 9
- 请关闭 "use auto layout" for your nibs if you want to match ios < 6
- Learning CCNA - Chapter 2: Introduction to TCP/IP
- Chapter 1. Introduction to Vectors
- 10 Things You Need To Know About Cocoa Auto Layout
- In-depth introduction to machine learning in 15 hours of expert videos
- Chapter 1__1.0 Connecting to Data----------------Introduction
- Introduction to Algorithm(chapter 3 and 4)
- This application is modifying the autolayout engine from a background thread, which can lead to engine corruption and weird crashes
- This application is modifying the autolayout engine from a background thread, which can lead to engi
- Chapter 6. Introduction to ASP.NET
- [译]Chapter 1 - An Introduction to ASP.NET MVC(3)
- Introduction to Algorithm - Summary of Chapter 2(2) - Merge Sort
- LKD: Chapter 9 An Introduction to Kernel Synchronization
- Auto Layout still required after sending -viewDidLayoutSubviews to the view controller. 终极解决方法
- PROGRAMMING THE WORLD WIDE WEB Chapter 2 Introduction to HTML
- This application is modifying the autolayout engine from a background thread, which can lead to engine corruption and weird crashes.