可能重複時:從2
iphone - 「Pushing the same view controller instance more than once is not supported」 exceptionUINavigationController的錯誤推視圖控制器
我正確地從1推test2ViewController如下,
self.controller2 = [[test2ViewController alloc] initWithNibName:@"test2ViewController" bundle:nil anUser:self.idUser];
[[self navigationController] pushViewController:self.controller2 animated:NO];
[self.controller2 release];
到1 I彈出它在初始化1之後(需要初始化)。
self.controller1 = [[test1ViewController alloc] initWithNibName:@"test1ViewController" bundle:nil anUser:self.idUser];
[[self navigationController] popToRootViewControllerAnimated:NO];
[self.controller1 release];
和問題appers試圖再次從2 1,應用程序崩潰與推錯誤時,
Pushing the same view controller instance more than once is not supported
什麼做錯了嗎?謝謝。
[[self navigationController] popToRootViewControllerAnimated:NO];應該是您需要讓第二個視圖控制器彈出的唯一行。你的第一個仍然存在於導航堆棧中。 – geraldWilliam
爲什麼你認爲你需要重新初始化? –