【发布时间】:2013-04-02 08:34:48
【问题描述】:
在我的项目中,我将本教程用于addChildViewControllers:http://www.wannabegeek.com/?p=168 在本教程中,情节提要上只有 3 个视图控制器。在我的项目 (ARC) 中,我得到了更多的视图控制器,并且我还不止一次地添加了故事板上的一些视图控制器。例如:
[self addChildViewController:firstViewController];
[self addChildViewController:firstViewController];
[self addChildViewController:firstViewController];
[self addChildViewController:secondViewController];
[self addChildViewController:secondViewController];
[self addChildViewController:thirdViewController];
问题是这会占用大量内存,因为它们都已加载。我的问题是如何减少这种情况?
【问题讨论】:
-
为什么要多次添加同一个视图控制器? AFAIK
addChildViewController只是在父视图控制器实例和子视图控制器实例之间创建关系,因此不需要多次调用它。例如,创建父子关系以向前旋转事件。所有视图控制器是否同时可见?
标签: ios objective-c memory-management