Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

Which is uinavigationcontroller and back button action?


Asked by Aurora Roman on Dec 13, 2021 FAQ



UINavigationController and back button action Ask Question Asked8 years, 5 months ago Active4 years, 6 months ago Viewed28k times 12 2 I have an two controllers1st is selfand 2nd is maincontroller, where I'm pushing maincontrollerin stack, so the back button is automatically coming.
In respect to this,
Or you can use the UINavigationController 's delegate methods. The method willShowViewController is called when the back button of your VC is pressed. Try putting this into the view controller where you want to detect the press:
Keeping this in consideration, Create your own subclass of UINavigationController, make it implement the UINavigationBarDelegate (no need to manually set the navigation bar's delegate), add a UIViewController extension that defines a method to be called on a back button press, and then implement this method in your UINavigationController subclass:
Also Know,
This is the preferred way because you set the backBarButtonItem only once in your view controller's navigation item, and then whatever view controller it will be pushing, the pushed controller will show the back button automatically on the nav bar.
Likewise,
Specifically, the navigation controller updates the bar button items displayed in each of the three navigation bar positions: left, middle, and right. Bar button items are instances of the UIBarButtonItem class.