Problem pushing multiple view controllers onto navigation controller stack

Posted by Jim on Stack Overflow See other posts from Stack Overflow or by Jim
Published on 2010-04-11T23:37:25Z Indexed on 2010/04/11 23:43 UTC
Read the original article Hit count: 285

Filed under:

Hi,

I am trying to push three view controllers onto the navigation controller. [self.navigationController pushViewController:one animated:YES]; [self.navigationController pushViewController:two animated:YES]; [self.navigationController pushViewController:three animated:YES];

The desired behavior is that view three will show, and when the back button is pressed it will go to view two and then to view one...

What actually happens is that view one is visible and pressing back goes to view two and then back again it goes to view one. Which is to say that view one is shown instead of view three.

Very strangely, looking at the viewController array of the navigationController after the calls above show the right entries, and looking at the visibleViewController property shows that it has view three in it... even though view one is visible.

If i navigate to a sub view from the visible view one (that shows in the place of view three) and press back from that sub view... it goes to view three.

It looks like it is showing view one, but knows it is on view three...

I am completely confused... any ideas?

Jim

© Stack Overflow or respective owner

Related posts about iphone-sdk