开发者

How to replace a viewController in the NavigationController Stack?

I have a navigationCon开发者_运维百科troller, I push a new viewController onto it's stack, I have been trying to figure out a way to switch this ViewController with another viewController from within the first ViewController.

I have 3 almost identical views, depending on the user interaction I would like to be able to switch between these views within the same stack index i.e. without pushing or popping views on the navigationController.

So if view C has index 3 on the navigationController stack and the user taps a certain button in view C the C1 view replaces C on the stack and gets index 3.

I have been through the UINavigation Class and can't find a way around this. If I popViewController from within the current viewController and the tries to pushViewController… well that can't be done as the viewController gets released when popping it. If I instead try to do pushViewController, well then I gets added on top of my current viewController.

I hope it makes sense and that someone can help me out:)

Thanks


You can assign an NSArray of controllers to the viewControllers property to alter the entire stack instantaneously.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜