[英]How to remove UIimageView from Superview
In my application I am adding a UIimage
on every button click.在我的应用程序中,我在每次单击按钮时添加一个
UIimage
。 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.由于用户可以添加他单击按钮的图像次数,因此我在该按钮上附加了一个标签“count1”,并且每次单击都会增加计数。 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...请帮忙...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.