ios - how to release uibuttons object in for loop? -
i looping uibuttons object in loop count , when have release object , unfortunately supposed work non-arc application
this code have done
for (uibutton *btn in [self.locationscrollview subviews]) { if ([btn tag]==1) [btn setbackgroundimage:[uiimage imagenamed:@"whiteleft.png"] forstate:uicontrolstatenormal]; else if ([btn tag]==8) [btn setbackgroundimage:[uiimage imagenamed:@"whiteright.png"] forstate:uicontrolstatenormal]; else [btn setbackgroundimage:[uiimage imagenamed:@"whitemid.png"] forstate:uicontrolstatenormal]; }
no need release object unless creating it. here btn
pointer button object. not release it.
[self.locationscrollview subviews]
returns array of sub views (may buttons). performing fast enumeration on array.
ios objective-c arrays for-loop uibutton
No comments:
Post a Comment