Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Pop Current View from Navigation Controller?

Is there a way to pop the current view from the Navigation Controller? Ideally in viewDidLoad, I would like to perform some sanity checking and if it fails, popup an error dialog and automatically close the current view (remove from parent N.avigation Controller)

like image 685
theactiveactor Avatar asked Apr 29 '10 19:04

theactiveactor


People also ask

How do I pop to present view controller in Swift?

You can do it by selecting the View Controller in Storyboard editor and clicking Editor -> Embed In -> Navigation Controller. Also make sure that you have your Storyboard Entry Point (the arrow that indicates which view controller is presented first) either pointing to Navigation Controller or before it.

How do I press view controller with navigation controller?

The object in the viewController parameter becomes the top view controller on the navigation stack. Pushing a view controller causes its view to be embedded in the navigation interface. If the animated parameter is true , the view is animated into position; otherwise, the view is simply displayed in its final location.


1 Answers

Look at the -popViewControllerAnimated: method. You might also look at UIAlertView for the error dialog box, and pop the current view controller from within the alert view delegate method, after the user clicks "OK" or the like.

like image 100
Alex Reynolds Avatar answered Sep 18 '22 21:09

Alex Reynolds