UIKit doesn't release controller if it is not removed with animation?
In a tab bar based application, If I have one controller pushed in the navigation stack from one tab and then, when another tab is active, I try to pop that controller, it doesn't get released unless I pop it without animation.
This works:
[navigationController popToRootViewControllerAnimated:NO];
And this does not:
[navigationController popToRootViewControllerAnimated:YES];
Does anyone have any idea of wha开发者_StackOverflow中文版t's happening here?
Is the animated
parameter being used improperly?
UPDATE:
Apple informed me that this is indeed a bug in UIKit, and they marked it as urgent and assigned somebody to it. It may have been resolved in the latest releases but I didn't have the time to check.
what Dshutsi suggests is right. If you want the notifications to be removed, that is better called in the viewDidUnload method of the controller. This method is called when the controller is unloaded from the stack. I am just quoting this because we cannot vote up the comment as an answer.
If the main problem are the observed notifications, why not remove the observers in the "-(void)viewWillDisappear:(BOOL)animated" - method?
精彩评论