I am trying to get my view controller to detect swipes in the UINavigationBar that is automatically displayed by my app, but it refuses to detect swipes. Is there any way I can do it?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Supposing you want to detect swipes to the left in your navigation bar, you could do something like this when you create the navigation controller:
and then create a method like the one below to handle it:
OBS: As you navigation controller is a class that will remain alive for several steps of you application life cycle, it is important to pay attention to that and add the gesture recognizer only when you create the navigation controller (which means only add it once) so that you dont keep piling gestures recognizer one over each other, wich will lead not only to a memory leak, but also might make your method
didSwipedLeftto be called more than once.