删除 UIView 的所有痕迹
我还有一个问题。 我有这个 NavigationController,它有一个委托:MainViewController。 在此导航控制器中,有一个表视图,它具有相同的委托:MainViewController。 每当我按下表中的一行时,就会弹出一个名为:itemViewController 的视图。
现在,这一切都非常有效。但是当我按下回车键时,我希望 itemViewController + 它的视图被完全遗忘,它必须被 100% 销毁。就像它从未存在过一样。
它有一个逻辑背景:每当我完成视图时,我都会按回键。当我想再次看到它时,我希望重新加载它,我不希望使用对视图的旧引用,因为它显示的数据一直在变化。因此,在我现在的情况下,我必须重新启动应用程序才能在视图中查看新数据。
我发现这真的令人沮丧。所以请帮助我,当我从表视图中再次单击该视图时,如何确保该视图被删除并完全重新加载?
I've got another question.
I've got this NavigationController, which has a delegate: MainViewController.
In this navigation controller, there's a table view, which has the same delegate: MainViewController.
Whenever I press a row in the table, a view pops up called: itemViewController.
Now, this all works really great. But when I press back, I want the itemViewController + it's view to be completely forgotten, it has to be destroyed 100%. Like it has never even existed.
which has a logical background: Whenever im done with the view, i press back. And when i want to see it again, i want it to be reloaded, i do not want an old reference to the view to be used, because the data it shows is changing all the time. So, in my situation right now, i have to relaunch the app to see the new data in the view.
Which, i find, really frustrating. So help me out, how can I make sure that view is deleted, and reloaded completely when i click on it again from the table view?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
取决于您如何编码对 itemViewController 的引用。
一般来说,[
itemViewController release];
将删除对视图控制器的引用。这意味着下次您需要 itemViewController 时,您将必须从头开始重新创建它(例如
[[itemViewController alloc] initWithNib: . . . . ]
)您可能会考虑的另一个选择是为 itemViewController 设置属性,并在将其推入视图之前简单地保留引用并更新属性。
如果没有看到您的代码,很难给出明确的答案。
Depends on how you have the reference to the itemViewController coded.
In general, [
itemViewController release];
will remove the reference to the view controller.The will mean that the next time you need the itemViewController, you will have to re-create it from scratch (e.g.
[[itemViewController alloc] initWithNib: . . . . ]
)Another option you might consider would be setting up properties for the itemViewController and simply keeping the reference around and updating the properties before you push it into view.
Hard to give a definitive answer without seeing your code.