ios - UIViewController -dealloc method not called -


i working automatic reference counting. have custom uiviewcontroller subclass , whenever call -presentviewcontroller: animated:completion: or remove view superview nslog "i dealloced" know view controller has been removed. have implemented -dealloc method in view controller. started test project had 2 uiviewcontroller instances (no retain cycles) , -dealloc not called either when push second uiviewcontroller modally or when remove superview or when remove parent view controller. missing ? in original project (not test case) instruments shows me controllers leave memory footprint can't rid off.

if want switch view controllers, , have 1 you're switching away deallocated, switch root view controller of window. so, if you're in vc1 , want go vc2, in vc1:

vc2 *vc2 = [[vc2 alloc] init]; // or else appropriate instance of class self.view.window.rootviewcontroller = vc2; 

if haven't created property point vc1, deallocated after making switch.

if want use modal presentation or modal segue (to animation when switch controllers), can still initial controller deallocated switching root view controller after presentation viewdidappear method of vc2:

-(void)viewdidappear:(bool)animated {     [super viewdidappear:animated];     self.view.window.rootviewcontroller = self; } 

Comments

Popular posts from this blog

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -