iosobjective-cautolayoutnslayoutconstraintvisual-format-language

Mix approach to create Autolayout constraints programmatically


I am trying to create Autolayouts programmatically so I referred the [Autolayout Guide][1]. In which I found three techniques to programmatically create Autolayouts

  1. Layout Anchors
  2. NSLayoutConstraint Class
  3. Visual Format Language

Regarding Visual Format Language Autolayout Guide Says:

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.


Solution

  • Of course - once a layout constraint is created (by whatever means), it is a normal layout constraint.