How can i remove an ImageView added on a dynamically created UIView, so that i can add another ImageView on my UIView.
+4
A:
You either add a tag for that UIImageView and find it based on tag or loop throughout the subviews and look for an object of class UIImageView containing the image you need to change.
Paul Ardeleanu
2010-10-31 09:47:53
+1
A:
Easiest way is probably with tags. So...
UIImageView *removeMe = [[UIImageView alloc] init];
removeMe.image = [UIImage imageNamed:@"theImage.png"];
removeMe.tag = 1;
[theView addSubview:removeMe];
[removeMe release]; //theView now retains it!
...then later:
UIImageView *removalTarget = (UIImageView *)[theView viewWithTag:1];
[removalTarget removeFromSuperview];
Dan Ray
2010-10-31 12:18:07