如果不通过动画移除控制器,UIKit 不会释放控制器?
在基于选项卡栏的应用程序中,如果我从一个选项卡推入导航堆栈中的一个控制器,然后,当另一个选项卡处于活动状态时,我尝试弹出该控制器,除非我在没有动画的情况下弹出它,否则它不会被释放。
这有效:
[navigationController popToRootViewControllerAnimated:NO];
而这无效:
[navigationController popToRootViewControllerAnimated:YES];
有人知道这里发生了什么吗? animated
参数使用不当吗?
更新:
Apple 告诉我这确实是 UIKit 中的一个错误,他们将其标记为紧急并指派专人处理。它可能已在最新版本中解决,但我没有时间检查。
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 what'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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Dshutsi 的建议是正确的。如果您希望删除通知,最好在控制器的 viewDidUnload 方法中调用。当控制器从堆栈中卸载时调用此方法。我只是引用这一点,因为我们不能投票赞成该评论作为答案。
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.
如果主要问题是观察到的通知,为什么不在“-(void)viewWillDisappear:(BOOL)animated”方法中删除观察者呢?
If the main problem are the observed notifications, why not remove the observers in the "-(void)viewWillDisappear:(BOOL)animated" - method?