How to implement the correct uinavigationbar back button functionality
ios, iphone, objective-c
Solution
[self.navigationController popViewControllerAnimated:YES];
will take you back to the previous view controller that was stacked in this navigation controller. that should do it..
Problem
I want to go back to the previous view controller when i click on the cancel button of my search display controller i used the code : ``` [self.navigationController popToViewController: [self.navigationController.viewControllers objectAtIndex:0] animated:YES]; ``` but it gives me the following error : * Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'search contents navigation controller must not change between -setActive:YES and -setActive:NO'