What is the difference of intrinsic size vs system width/height constraints?

后端 未结 4 744
梦毁少年i
梦毁少年i 2021-02-02 14:08

Starting to move from springs and structs layout to auto layout and have some questions regarding \"Intrinsic Size\" setting.

If you set \"Intrinsic Size\" of some view

4条回答
  •  萌比男神i
    2021-02-02 14:53

    When Intrinsic size set to Placeholder, containerView calculates its own height according to its subView(containeeView)

    containerView grows or shrinks according to what's inside of it.

    -Set width and position for view, not height -set view.intrinsicSize = Placeholder -Put a label inside view -snap label to all borders of the view -do not set height for label (or set height with >= operator. Not = operator) -set label as lines=0, lineBreak=WordWrap

    According to content size, label will grow or shrink in height. view will grow or shrink height according to label height.

提交回复
热议问题