John S
John S

Reputation: 1747

iOS global method

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.

Upvotes: 0

Views: 954

Answers (2)

Adam Wright
Adam Wright

Reputation: 49386

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?

Upvotes: 1

Kheldar
Kheldar

Reputation: 5389

You could write a category, and apply it to UIViewController. Item 11 here clearly explains how to do that.

Upvotes: 3

Related Questions