ios - 释放内存 Dismissing Modal View Controller

标签 ios memory-management modalviewcontroller

我的应用程序由一个父 View Controller 组成,它有 10 个按钮,它们都通向 10 个不同的模态视图,所有这些 View 都有相当多的内容。该应用程序在模拟器上完美运行,但在实际设备上,它会收到许多内存警告,有时还会崩溃。

在使用分配工具在模拟器上测试应用程序时,我注意到当我呈现或关闭模态视图时内存会增加并且不会减少。我什至可以一遍又一遍地呈现和忽略同一个,并且内存不断增加。

我的模态视图代码如下所示:

MyViewController *controller = [[MyViewController alloc] initWithNibName:nil bundle:nil];
[self presentModalViewController:controller animated:YES];
[controller release];

然后解雇:
[self dismissModalViewControllerAnimated:YES];

我在模态视图 Controller 的 dealloc 方法中释放了许多按钮和 ImageView 。我分析程序时没有问题,没有错误或警告。

最佳答案

此方法在 iOS 6.0 之后被贬值。
试试这个线程[1]。

[1]:Dismiss popover when clicking a uibutton “这个链接”。

关于ios - 释放内存 Dismissing Modal View Controller,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6867334/

相关文章:

iOS:将 View 旋转应用于模态视图下的 View Controller

iOS - UIView 子类不会随设备旋转

c++ - 内存堆问题C++,动态分配多维数组

ios - NSInvalidArgument 异常 - 随机对象接收 didEnterBackground

c# - MemoryFailPoint 始终抛出 InsufficientMemoryException,即使内存可用也是如此

iphone - modalViewController 委托(delegate)回调 - 如何?

ios - 自定义 UISwitch?

ios - 无法在 Identity Inspector 中设置自定义 UITextView

ios - 比较 If 中的枚举类型

controller - iPad 上 UIDocumentInteractionController : presentPreviewAnimated is not pushed into the navigation stack 的可能错误