Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does [UIView removeFromSuperview] also remove its children views recursively?

I have a view hierarchy that I need to remove entirely. Is it okay to just call removeFromSuperview on the top parent view or do I need to visit each child node recursively and remove it individually?

Edit: Just to clarify, I understand that removing the parent physically removes the children from view, but does that also decrease their ref-counts appropriately?

like image 270
S B Avatar asked Nov 25 '11 14:11

S B


People also ask

Does removing from superview remove constraints?

If the view's superview is not nil , the superview releases the view. 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.


1 Answers

All subviews belong to the view; so, when you remove a view from it's superview - it is removed with all it's subviews.

like image 152
Denis Avatar answered Oct 04 '22 04:10

Denis