Possible Duplicate:
iphone – “Pushing the same view controller instance more than once is not supported” exception
I am properly pushing test2ViewController from 1 as follows,
self.controller2 = [[test2ViewController alloc] initWithNibName:@"test2ViewController" bundle:nil anUser:self.idUser];
[[self navigationController] pushViewController:self.controller2 animated:NO];
[self.controller2 release];
from 2 to 1 I pop it after initialize 1 again (necessary to initialize).
self.controller1 = [[test1ViewController alloc] initWithNibName:@"test1ViewController" bundle:nil anUser:self.idUser];
[[self navigationController] popToRootViewControllerAnimated:NO];
[self.controller1 release];
and problem appers when trying to push again 2 from 1, app crashes with an error,
Pushing the same view controller instance more than once is not supported
what am doing wrong? thank you.
Well first off you are creating another instance of test2ViewController so you will go to a different instance each time you change view.
What you should do:
and to return, simply:
PoppingtoRoot causes you to pop to the very first view controller that used the pushViewController method.