Centering a view in its superview using Visual Format Language

前端 未结 14 1347
天命终不由人
天命终不由人 2020-12-02 03:52

I just started learning AutoLayout for iOS and had a look at Visual Format Language.

It all works fine except for one thing: I just can\'t get a view to center withi

14条回答
  •  温柔的废话
    2020-12-02 04:46

    What it have to be done is that superview should be declared in the dictionary. Instead of using | you use @{@"super": view.superview};.

    And NSLayoutFormatAlignAllCenterX for vertical and NSLayoutFormatAlignAllCenterY for horizontal as options.

提交回复
热议问题