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

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -