小编Ech*_*man的帖子

当调用navigationController popViewControllerAnimated时,不会调用viewController的dealloc

我有一个MyViewController,它基于UIViewController,我使用它像下面的代码:

MyViewController *nextViewController = [[MyViewController alloc] init]; [self.navigationController pushViewController:nextViewController animated:YES]; [nextViewController release];

在具有用户事件的MyViewController中,具有以下代码:

[self.navigationController popViewControllerAnimated:YES];

现在,我发现,MyViewController的dealloc不会被调用,但是,当我将App切换到后台时,例如,传递home按钮,dealloc方法已被调用!这个大问题!当用户转到MyViewController并且一次又一次地返回时,会有很多MyViewController不会被释放,而且只有当App转到后台时才会释放大量内存.

所以,有人可以帮我解决这个问题,谢谢!

memory-leaks dealloc navigationcontroller ios popviewcontrolleranimated

3
推荐指数
1
解决办法
3304
查看次数