为了测试和编写代码,我需要重新启动我的GameViewContrller
GameViewController *controller = [[GameViewController alloc] initWithNibName:@"GameViewController" bundle:nil];
[self presentModalViewController:controller animated:NO];这个方法重新启动viewController,但是由于我的操作/进程正在进行,所以所有存储在内存中的内存都会增加,因为每次不重新启动都会增加内存。我想这不是正确的方法,而且想知道怎么做,完全用内存覆盖viewController,删除所有的进程,然后重新开始。
更新
- (IBAction)restartButtonPress {
// GameViewController *controller = [[GameViewController alloc] initWithNibName:@"GameViewController" bundle:nil];
// [self presentModalViewController:controller animated:NO];
[self.view setNeedsDisplay];
}发布于 2013-03-23 10:46:53
调用用于重新加载视图的[self.view setNeedsDisplay];。同样,您可以使用[self viewDidLoad]方法,但这对我们没有好处,而且我们也不手动调用viewDidLoad。所以你可以使用setNeedsDisplay。
发布于 2013-03-23 10:45:25
这只会开始一个新的。它不会重设旧的。
要删除旧的,需要将[controller release]调用为旧的。
https://stackoverflow.com/questions/15585784
复制相似问题