iOS global method
-
17-01-2021 - |
Pregunta
I'm doing an application where I want the user to be able to use swipe gestures to push and pop view controllers. I will be using a swipe gesture recogniser to achieve this. My question is, is there any way I could implement the recognisers globally as opposed to implementing it in every single view controller? Thanks.
Solución
You could write a category, and apply it to UIViewController. Item 11 here clearly explains how to do that.
Otros consejos
You can add the gesture recogniser to your UIWindow
, as detailed in How to add a vertical swipe gesture to iPhone app for all screens?
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow