Timur Mustafaev Timur Mustafaev - 1 month ago 7
iOS Question

How to press "Back" button in UINavigationController programmatically

I have a

UIViewController
called
FriendsViewController
inside a
UINavigationController
. And a second
UIViewController
called
FriendsDetailedViewController
. When navigating from the first view controller to the second, I want to programmatically press the
Back
button when needed. How to do this?

Answer

Simply use

[self.navigationController popViewControllerAnimated:YES]

from FriendsDetailedViewController. Your view will be popped out i.e. the behavior of back button