简体   繁体   English

混合方法以编程方式创建自动布局约束

[英]Mix approach to create Autolayout constraints programmatically

I am trying to create Autolayouts programmatically so I referred the [Autolayout Guide][1]. 我试图以编程方式创建自动Autolayouts因此我参考了[自动布局指南] [1]。 In which I found three techniques to programmatically create Autolayouts 在其中我发现了三种以编程方式创建Autolayouts技术

  1. Layout Anchors 布局锚
  2. NSLayoutConstraint Class NSLayoutConstraint类
  3. Visual Format Language 视觉格式语言

Regarding Visual Format Language Autolayout Guide Says: 关于“ 视觉格式语言自动 Autolayout Guide说:

The notation emphasizes good visualization over completeness. 该符号强调对完整性的良好可视化。 Therefore some constraints (for example, aspect ratios) cannot be created using the visual format language. 因此,无法使用视觉格式语言创建某些约束(例如,宽高比)。

Can I mix Visual Format Language with Layout Anchors to create other constraints with Visual Format Language and Aspect ratio constraints with Layout Anchors . 我可以混用Visual Format LanguageLayout Anchors创建其他constraintsVisual Format LanguageAspect ratio constraintsLayout Anchors

当然-一旦创建了布局约束(通过任何方式),它就是正常的布局约束。

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

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