CocoaDev

Edit AllPages

Here’s a simple class that lets your app respond to a Keyspan remote (URM - 15T).

@interface KeyspanObserver : NSObject {

} @end

static NSDictionary *KeyspanActions = nil; static BOOL ShouldRespondToKeyspanActionsInBackground = NO;

@implementation KeyspanObserver

static BOOL KeyspanObserverAction(SEL action, NSResponder *responder, NSNotification *note, NSMethodSignature *delegateSignature) { if ([responder respondsToSelector:action]) { [responder performSelector:action withObject:note]; return YES; } id delegate; if ([responder respondsToSelector:@selector(delegate)] && responder methodSignatureForSelector:@selector(delegate)] isEqual:delegateSignature] && [(delegate = [responder performSelector:@selector(delegate)]) respondsToSelector:action]) { [delegate performSelector:action withObject:note]; return YES; } return NO; }

}

The responder chain is searched first for an action handler. If the responder chain doesn’t handle the action, NSApp and its delegate get a shot at it.

You can have a document object, an app delegate or a responder object handle remote button actions.

–zootbobbalu