iOS swipe gesture not working when Search Display Controller is showing results

784 views Asked by At

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

There are 1 answers

2
rambodrahmani On BEST ANSWER

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;