iphone - dealloc not called when i used addChildViewController -
i using below code add view addchildviewcontroller.
videolistvc * videolistvc = [[videolistvc alloc] initwithnibname:@"videolistvc" bundle:nil]; uinavigationcontroller * navcontroller = [[uinavigationcontroller alloc] initwithrootviewcontroller:videolistvc]; navcontroller.view.frame = self.view_container.bounds; videolistvc.view.frame = navcontroller.view.bounds; [self addchildviewcontroller:navcontroller]; [navcontroller didmovetoparentviewcontroller:self] [self.view_container addsubview:navcontroller.view]; self menuvc in add multiple viewcontrollers childview. called menuvc pushviewcontroller when in menuvc can see videolistvc child view. when called popviewcontrolleranimated time dealloc method not called of menuvc videolistvc. problem viewcontroller memory not release , apps memory continuously increase due this. , app crash when surt app around continuously 20 25 min.
what way resolved ?? had tried removefromparentviewcontroller not getting success.
any thing wrong in code addchildviewcontroller ??
1) second line should be
uinavigationcontroller * navcontroller = [[uinavigationcontroller alloc] initwithrootviewcontroller:videolistvc]; 2) in case don't use arc, should release videolistvc , navcontroller @ end, because videolistvc retained due initwithrootviewcontroller call, , navcontroller retained due addchildviewcontroller.
3) don't know if important, listing 14-1 of apple's view controller programming guide ios shows sequence when adding childvc:
[self addchildviewcontroller:content]; // 1 content.view.frame = [self frameforcontentcontroller]; // 2 [self.view addsubview:self.currentclientview]; [content didmovetoparentviewcontroller:self]; // 3 hope helps.
Comments
Post a Comment