I have a parent UIView with a number of subviews. Periodically I need to remove a subview and completely remove it from the system. What is the correct way to do this? I tried this:
UIView *v = [self.containerView viewWithTag:[n integerValue]];
[v removeFromSuperview];
and got a bizarre result. Previously present UIView
s disappeared as well. What's going on?
To remove all subviews from your view:
If you want to remove some specific view only then:
You can also delete sub views by tag value: