1
votes

Something really strange is happening in the Search View Controller (a normal View Controller with a Search Display Controller connected to a UISearchBar and a TableView) of my app and that is the swipe gesture (the one that takes you back to the View where you came from) is not working when Search Display Controller is showing results.

I mean, to be more explicit: when the table view is showing the results of the search made using the UISearchBar I can try and try again to swipe from left to right and nothing happens.

If I press the cancel button or the button that clears the text of the UISearchBar then everything works normally: I mean I can again use the swipe gesture (from the left side of the device screen to right side of the device screen) to get back to the view where I came from.

Anybody experiencing the same thing?

1
Hmmm... Is it maybe first responder at that point? I'd try adding a touches did begin and resign first responder with the search bar.Nate Birkholz
I am executing [searchBar resignFirstResponder]; in searchBarCancelButtonClicked, searchBarTextDidEndEditing and also in searchBarSearchButtonClicked. Is that ok?rambodrahmani
I made my reply an answer so the code remains formatted. Hope it helps!Nate Birkholz

1 Answers

0
votes

I still don't what's wrong with the UISearchBar or the Search Display Controller but when they become FirstResponder they disable the interactivePopGestureRecognizer of the navigationController.

It results in not letting you user the swipe gesture to go back.

TO FIX THIS:

I added these two lines of code in my viewDidLoad method:

self.navigationController.interactivePopGestureRecognizer.enabled = true;
self.navigationController.interactivePopGestureRecognizer.delegate = self;