What happens with constraints when a view is removed

前端 未结 6 1554
無奈伤痛
無奈伤痛 2020-12-07 21:31

The question I have is simple but I couldn\'t find any information in the documentation.

What happens with layout constraints when a view is removed from the view hi

6条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-07 22:22

    Since I had this question too, I checked the Apple Docs just for kicks, and it turns out that it is documented that the constraints are removed.

    The documentation for the UIView removeFromSuperview method states:

    Calling this method removes any constraints that refer to the view you are removing, or that refer to any view in the subtree of the view you are removing.

    I'm not sure if this was documented last year when the original question was posted, but I just thought I'd share this information in case anyone needed it...

提交回复
热议问题