views:

79

answers:

1

Hi,

I have a view in which I have few labels and I want to dynamically clear the view (remove all the labels) at certain condition in my application.

Please help me

Regards, Pratik

+3  A: 

Your most logical option is to use a separate view for the next stage of your interface rather than changing them out, maybe using UIViewControllers.

If you really want to do this, though:

for (UIView *v in myView.subviews) {
    // Include the if-statement if you want to remove UIControls only
    if ([v isKindOfClass:[UIControl class]]) {
        [v removeFromSuperview];
    }
}
jtbandes
consider hiding as well - [v setHidden:YES];
Till
There's no need to hide it if it's being removed entirely...
jtbandes