2010-08-03 59 views
0

我通過自動創建UIImageViews的一個for循環:如何更改自動生成的UIImageViews?

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]; 
}; 

現在,在事件發生後,在「breitescroller2」的變化,我需要改變的UIImageView的全部寬度。通過再次調用此代碼,較舊的代碼保持在那裏,並導致內存問題。有任何想法?是否有可能通過removeFromSuperview給他們標籤並刪除舊標籤?

非常感謝!

回答

0
for (id view in [Indalt1 subviews]) { 
    if ([view isKindOfClass:[UIImageView class]]) { 
     [view removeFromSuperview]; 
    } 
} 
+0

完美!非常非常感謝你!它工作得很好! – Jonathan 2010-08-03 09:11:23

相關問題