zoukankan      html  css  js  c++  java
  • Chapter 15 Introduction to Auto Layout

    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.

  • 相关阅读:
    CentOS更改yum源与更新系统
    JQ兼容各种JS库的写法
    虚拟主机
    SSH安全登录(远程管理)22端口
    Samba服务器
    VSFTP服务
    网络配置和文件服务器
    服务和进程管理(二)
    攻防世界XCTF--一个登录验证页面(第六题)
    攻防世界XCTF--一个不能按的按钮(第五题)
  • 原文地址:https://www.cnblogs.com/1oo1/p/3991231.html
Copyright © 2011-2022 走看看