raheel
raheel

Reputation: 1417

Custom UIResponder subclass

Is it possible to set up a custom UIResponder subclass? I need to implement a listener for UIEvents (specifically remote control events) that will be delivered through out the course of the app's lifecycle.

I am trying to avoid using UIViewControllers (will be dealloced at some point) and AppDelegate (would like to not burden it if possible) if possible.

Upvotes: 2

Views: 1323

Answers (1)

matt
matt

Reputation: 535232

Obviously you can subclass UIResponder and you can make an instance of that subclass. The problem is getting that instance into the responder chain, so that its UIResponder methods are actually called, and in such a way that the rest of the responder chain doesn't break. This might be possible — I've certainly done it in Cocoa on the desktop, though never in UIKit on an iOS device — but you would do much better, in my opinion, to give some introspective thought to why you have this peculiar aversion to putting the code where it obviously wants to go (in a UIViewController or in the app delegate).

Upvotes: 1

Related Questions