iphone - How to remove a subview (or all subviews of a view) -
i have method in alloc , init
uiview (`tabsclippedview = [[[uiview alloc] initwithframe:tabsclippedframe] autorelease];`).
this view has view added
(`tabsview = [[[uiview alloc] initwithframe:tabsframe] autorelease];`).
then initiate couple of buttons
(e.g. `uibutton* btn = [[[uibutton alloc] initwithframe:frame] autorelease];`)
and add them subview of view.
now time time, need delete buttons , assign them again. best way delete entire view or subview added buttons?
how need (without memory leaking etc.)? would simple
self.tabsview = nil;
suffice delete view , of subviews (i.e. buttons)?
or better delete superview well, start entirely scratch:
self.tabsclippedview = nil;
since uiview autoreleased, need remove superview. there removefromsuperview
method.
so, you'd want call [self.tabsview removefromsuperview]
. long property declaration set retain
that's you'll need.
Comments
Post a Comment