Re: AppleRemote Cocoa Class ( delegate issue )
Re: AppleRemote Cocoa Class ( delegate issue )
- Subject: Re: AppleRemote Cocoa Class ( delegate issue )
- From: Dorian Johnson <email@hidden>
- Date: Tue, 26 Jun 2007 20:50:29 -0500
A singleton is a design pattern where only one instance of the class
ever exists. This means you simply use [AppleRemote sharedRemote]
anywhere you want to use the object.
The appleRemote method you have in your delegate isn't necessary
(it's not one of the AppleRemote delegate methods). The example
project only has it for use with bindings (to tie the button to the
AppleRemote singleton object). What you need to do is remove that
method, then use (if you're encapsulating it differently that's fine
but this is what it needs to end up as)
c_Delegate = [[Delegate alloc] init];
[[AppleRemote sharedRemote] setDelegate:c_Delegate];
[[AppleRemote sharedRemote] startListening:nil];
Dorian
On Jun 26, 2007, at 8:41 PM, David Farmer wrote:
thanks for the reply!
not sure I understand singleton? if I do not allocate it to create
an instance what should I do? if I try to create a static
declaration it barks at me. ( sorry, might be a bit thick as well )
In Delegate.h I implemented both -(AppleRemote*)appleRemote; and -
(void)appleRemoteButton:(AppleRemoteEventIdentifier)
buttonIdentifier pressedDown:(BOOL)pressedDown; It is a newly
created class based on NSObject. Those are the only methods. From
your explanation I believe that this may all be related to
incorrectly using the AppleRemote class ( the singleton use that
still eludes me ).
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden