I have many UIImageView in an NSMuatableArray and I need to remove a certain UIImageView from the view, but I think that if I release the UIImageView it will still be in the array.
I don’t want that, but there is a little problem. The UIImageView that I need to remove is exactly 1 object before the last object in the array, so I can’t use removeLastObject. I do know the tag number, but I can’t write it like this because I would change the array while using it.
for (UIImageView *k in array1) {
if (k.tag==tagzahl-1) {
if (x==1){
[k removeFromSuperview];
[array1 remove object:k];
}
}
}
I am using: [array1 addObject:myimage]; to add the UIImageViews to the array, so I do not know the index.
If you know that tag which you say you do then