views:

14

answers:

1

Hello,

i create UIImageViews automatically via a for-loop:

for (int i=0; i<anzahlzeilen; i++) {
   Anfanggrau = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Grauer-Balken.png"]];
   Anfanggrau.frame = CGRectMake(0, [heightofrow intValue]*i,[breitescroller2 intValue],[heightofrow intValue]); 

   [Inhalt1 addSubview:Anfanggrau];
   [Anfanggrau release];
};

Now, after an event, the "breitescroller2" changes and i need to change all the widths of the UIImageView. By calling this code a second time, the older one stay there and i cause a memory problem. Got anyone an Idea? Is it Possible to give them tags and delete the older one's by removeFromSuperview?

Thank you very much!

A: 
for (id view in [Indalt1 subviews]) {
    if ([view isKindOfClass:[UIImageView class]]) {
        [view removeFromSuperview];
    }
}
jamapag
perfect!! thank you very very much! it works great!
Jonathan