开发者

How to remove UIimageView from Superview

开发者 https://www.devze.com 2023-03-21 17:38 出处:网络
In my application I am adding a UIimage on every button click. As user can add that image number 开发者_如何学运维of times he clicked button, I have attached a tag \"count1\" with that button, and cou

In my application I am adding a UIimage on every button click. As user can add that image number 开发者_如何学运维of times he clicked button, I have attached a tag "count1" with that button, and count increases on every click. Thus i can differentiate every image with its tag.

Now i want to remove all those images, on another button click.

I tried to remove those images through the following piece of code

for (int i=1; i<=count1; i++) 
    {
        UIImageView *imgRemove;
        [[imgRemove viewWithTag:i] removeFromSuperview];

    }

but my application is crashing when I press the button.

please help...


If you want to remove a view form the super view look at this question (with answer): link

0

精彩评论

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