导航控制器和栏 - 内存管理
首先...我是意大利人,所以我很抱歉我的英语不好!
所以...这是我的应用程序: 我正在使用导航控制器:在第一个视图中有 10 个按钮,每个按钮都调用这样的函数:
[self pushViewController:nameview animated:YES];
到不同的 uiviewcontroller!所以我有 11 个 uiviewcontroller! 每个控制器都像这里一样被声明
@interface ...
IBoutlet UIViewController *viewcontroller;
...
@property (nonatomic, retain) IBOutlet UIViewController *viewcontroller;
最后我不得不说我正在与 IB 合作!
我的问题是我的应用程序不释放内存! 当我在一个视图中并点击“backbuttonitem”(由IB创建,而不是我创建)时,最后一个视图不会被发布(再次,对不起我的英语不好)......并且如果用户看到所有10查看后,app收到一条警告消息(内存不足)!
如何释放 popviewcontroller 操作之前看到的最后一个视图?
谢谢:D
first of all... i'm italian, so i'm sorry for my bad english!
so... this is my app:
i'm using a navigation controller: in the first view there are 10 buttons and every button calls a functions like this:
[self pushViewController:nameview animated:YES];
to a different uiviewcontroller! So i have 11 uiviewcontroller!
Every controller is decleared like here
@interface ...
IBoutlet UIViewController *viewcontroller;
...
@property (nonatomic, retain) IBOutlet UIViewController *viewcontroller;
Finally i have to say that i'm working with IB!
My problem is that my app doesn't release memory!
when i'm in a view and i tap on the "backbuttonitem" (created by IB, not by me) the last view doesn't became released (again, sorry for my bad english)... and if an user see all 10 view, the app receive a warning massage (low-memory)!
How can i release the last view saw before the popviewcontroller action?
thanks :D
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当您将视图控制器推送到导航控制器时,您需要释放它,因为导航控制器现在拥有它。例如,您将执行以下操作:
然后,当您使用
popViewControllerAnimated:
时,导航控制器将负责确保视图控制器从内存中释放。When you push a view controller onto a navigation controller you need to release it as the navigation controller now owns it. For example you would do the following:
Then when you use
popViewControllerAnimated:
the navigation controller will take care of making sure the view controller is released from memory.