Yes. You can view representations as a tree structure. Therefore, if you specify that the view will be removed from the super view, the entire structure will be deleted.
For example: A UIButton
is actually a view containing a UILabel
that displays the name of the button. So you can do it [myUIButton removeFromSuperview];
, which will remove the button and its own hierarchy of views (including the button containing the UILabel).
Note If you only want to hide / show the view, you can also set its hidden
property to YES
or NO
instead of removing the view from the view hierarchy. Thus, it is easy to display the view again.
source share