Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
276 views
in Technique[技术] by (71.8m points)

cocoa touch - How to go back one view in UINavigationController?

Is there a method to go back one view in the stack on a UINavigationController? Or to a view with a specific title?

question from:https://stackoverflow.com/questions/3293155/how-to-go-back-one-view-in-uinavigationcontroller

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I don't mean to be rude, but this is really well documented. A google search or even an Apple documentation search on UINavigationController will turn up exactly what you need. To programmatically pop the current view controller you use:

[[self navigationController] popViewControllerAnimated:YES];

To pop to a specific view controller, you use:

[[self navigationController] popToViewController:controller animated:YES];

You will have to iterate through the list of view controllers first and check the title against what you're looking for and pass that to this method.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...