【发布时间】:2011-08-01 08:47:31
【问题描述】:
我在我的应用程序中使用了 3 个 UIViewController,现在我想知道当我切换到另一个时释放它们是否是个好主意。显然,这将是隐藏的那些我真的不需要它们,而它们不可见...... 切换视图,我使用这样的东西(uiwindow):
//this is in the first UIViewController
[[[UIApplication sharedApplication] keyWindow] addSubview:secondController.view];
[self.view removeFromSuperview];
//here I release the view controller
[self release];
所以我的问题...这真的值得吗?可能是什么性能问题?
另外,我想问一下是否有人知道为什么这些行按此顺序工作(见下文)。我尝试了相反的方法,但停止工作的方向有问题?有什么提示吗?
//working
[[[UIApplication sharedApplication] keyWindow] addSubview:secondController.view];
[self.view removeFromSuperview];
//not working
[self.view removeFromSuperview];
[[[UIApplication sharedApplication] keyWindow] addSubview:secondController.view];
谢谢
劳尔
【问题讨论】:
标签: iphone cocoa-touch uiviewcontroller uikit uiwindow