开发者

iPhone + clear all UI Controls from View

开发者 https://www.devze.com 2022-12-11 20:45 出处:网络
I have a view in which I have few labels an开发者_StackOverflowd I want to dynamically clear the view (remove all the labels) at certain condition in my application.

I have a view in which I have few labels an开发者_StackOverflowd I want to dynamically clear the view (remove all the labels) at certain condition in my application.

Please help me

Regards, Pratik


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];
    }
}
0

精彩评论

暂无评论...
验证码 换一张
取 消