How can I pop a view from a UINavigationController and replace it with another in one operation?
Posted
by Matt Brandt
on Stack Overflow
See other posts from Stack Overflow
or by Matt Brandt
Published on 2009-01-04T04:38:35Z
Indexed on
2010/03/15
18:49 UTC
Read the original article
Hit count: 432
I have an application where I need to remove one view from the stack of a UINavigationController and replace it with another. The situation is that the first view creates an editable item and then replaces itself with an editor for the item. When I do the obvious solution within the first view:
MyEditViewController *mevc = [[MYEditViewController alloc] initWithGizmo: gizmo];
[self retain];
[self.navigationController popViewControllerAnimated: NO];
[self.navigationController pushViewController: mevc animated: YES];
[self release];
I get very strange behavior. Usually the editor view will appear, but if I try to use the back button on the nav bar I get extra screens, some blank, and some just screwed up. The title becomes random too. It is like the nav stack is completely hosed.
What would be a better approach to this problem?
Thanks, Matt
© Stack Overflow or respective owner