automatic ref counting - iOS: destroy subviews in viewDidDisappear? -
i have uinavigationcontroller
uiviewcontroller
pushed onto it. in viewcontroller
s view
, have 2 subview uiscrollview
s. recreate these scrollview
s every time in viewwillappear
method in viewcontroller
, add them subviews viewcontroller's view. using arc, should destroying 2 scroll views in viewdiddisappear
method? better practice memory usage.
edit: did investigation, , without removing scroll views , setting them nil in viewdiddisappear
method, not released. viewcontroller's view gets increasing number of subviews viewwillappear
called. mentioned in comments, never deallocate main viewcontroller. stays on navigation controller's stack. why must manually release scroll views?
it may not necessary @ all. if uiviewcontroller removed screen , being deallocated, automatically deallocate view hierarchy (including subviews have added). easy way check override dealloc
methods of classes you're interested in (using objc category method added class), , log message indicate they've been removed.
Comments
Post a Comment