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'
[self.navigationController popViewControllerAnimated:YES];
will take you back to the previous view controller that was stacked in this navigation controller. that should do it..
My Problem was the searchdisplay controller cannot setActive by the uinavigator so i solve my problem by add the following code :
[self.searchDisplayController setActive:NO];
[self.navigationController popViewControllerAnimated:YES];
the Error was :
* Assertion failure in -[UISearchDisplayController setActive:animated:], /SourceCache/UIKit_Sim/UIKit-1914.84/UISearchDisplayController.m:617 2012-05-13 19:07:44.696 MyApp[3648:11903] * Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'search contents navigation controller must not change between -setActive:YES and -setActive:NO'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With