Re: Sending a Selector to another Class.

2009-10-22 Thread Rob Keniger
On 22/10/2009, at 3:52 PM, Joshua Garnham wrote: Ah, I see. so I need to send it to an instance of the class not the class it self. How would I do that? With respect, please understand that your questions are akin to this: Q. How do I start the car? A. You turn the key. Q. How do I drive?

Re: Sending a Selector to another Class.

2009-10-22 Thread Paul M
With all due respect, but by 'directly answering the question' you are doing the OP and all those reading this list a dis-service. You are just rewarding his lazyness. The OP has already been told to bone up on Obj-C basics, and he's obviously completely ignored this advice, the reason being

Re: Sending a Selector to another Class.

2009-10-22 Thread Jim Kang
Jens, thanks for clearing up the thing about the selector defining a message (method plus parameters) rather than a method and thus not being tied to a class. On Thu, Oct 22, 2009 at 1:21 AM, Jens Alfke j...@mooseyard.com wrote: On Oct 21, 2009, at 9:43 AM, Jim Kang wrote: That selector is a

Re: Sending a Selector to another Class.

2009-10-22 Thread Bill Bumgarner
On Oct 22, 2009, at 5:54 AM, Jim Kang wrote: However, a selector is not a string. I was just listening to this podcast with Mike Ash, and he discusses this around the 9:23 mark or so:

Re: Sending a Selector to another Class.

2009-10-22 Thread Jens Alfke
On Oct 22, 2009, at 5:54 AM, Jim Kang wrote: However, a selector is not a string. I was just listening to this podcast with Mike Ash, and he discusses this around the 9:23 mark or so:

Re: Sending a Selector to another Class.

2009-10-22 Thread Kyle Sluder
On Oct 22, 2009, at 9:01 AM, Jens Alfke j...@mooseyard.com wrote: This statement is true; however those integers happen to be the memory addresses of unique instances of the strings*. This makes it very efficient for the runtime to convert a selector to an NSString, and vice versa, and

Re: Sending a Selector to another Class.

2009-10-22 Thread Jeff Johnson
On Oct 22, 2009, at 10:53 AM, Bill Bumgarner wrote: Selectors are strings, but it is an implementation detail. The runtime uniques the strings such that there is only ever one instance of, say, the drawRect: selector floating about. Thus, the runtime can use pointer comparison to

Re: Sending a Selector to another Class.

2009-10-22 Thread mmalc Crawford
On Oct 22, 2009, at 9:54 am, Jeff Johnson wrote: Ignore bbum. We hereby promise never to break == for SEL. (But SEL is not char*. We will break that.) And now that it's on the mailing lists, it can be considered part of Apple's official documentation. ;-) It already is:

Sending a Selector to another Class.

2009-10-21 Thread Joshua Garnham
How would I send a Selector to another class? I know to send it to a selector in the same file you do [self performSelector:@selector(doSomething)]; and for sending it to another class I've tried [otherClass performSelector:@selector(doSomethingElse)]; But I just get an error in the Debugger

Re: Sending a Selector to another Class.

2009-10-21 Thread I. Savant
On Oct 21, 2009, at 12:23 PM, Joshua Garnham wrote: How would I send a Selector to another class? I know to send it to a selector in the same file you do [self performSelector:@selector(doSomething)]; and for sending it to another class I've tried [otherClass

Re: Sending a Selector to another Class.

2009-10-21 Thread Shawn Erickson
On Wed, Oct 21, 2009 at 9:23 AM, Joshua Garnham joshua.garn...@yahoo.co.ukwrote: How would I send a Selector to another class? I know to send it to a selector in the same file you do [self performSelector:@selector(doSomething)]; Why not simply... [self doSomething] ? and for sending it

Re: Sending a Selector to another Class.

2009-10-21 Thread Joshua Garnham
. From: Shawn Erickson shaw...@gmail.com To: Joshua Garnham joshua.garn...@yahoo.co.uk Cc: cocoa-dev@lists.apple.com Sent: Wednesday, 21 October, 2009 18:02:55 Subject: Re: Sending a Selector to another Class. On Wed, Oct 21, 2009 at 9:23 AM, Joshua Garnham

Re: Sending a Selector to another Class.

2009-10-21 Thread Quincey Morris
On Oct 21, 2009, at 10:02, Shawn Erickson wrote: But I just get an error in the Debugger saying +[otherClass doSomethingElse]: unrecognized selector sent to class 0xe5c4 You are sending a message to an object that doesn't respond to that message (aka no implementation for it). The error

Re: Sending a Selector to another Class.

2009-10-21 Thread Phillip Mills
- Message from joshua.garn...@yahoo.co.uk - but i get a warning in xcode, http://cld.ly/7c4la. (JGManagedObject is what replaces otherClass) That one is usually a case of not importing the JGManagedObject header or not declaring the class method in that interface.

Re: Sending a Selector to another Class.

2009-10-21 Thread Jim Kang
That selector is a unique index that points to a method of a specific class. Methods themselves belong to a specific class and can't operate outside of their classes. (They compile down to regular C functions that accept an additional object parameter.) So, it doesn't make sense to use one class's

Re: Sending a Selector to another Class.

2009-10-21 Thread Joshua Garnham
Sent: Thursday, 22 October, 2009 6:21:29 Subject: Re: Sending a Selector to another Class. On Oct 21, 2009, at 9:43 AM, Jim Kang wrote: That selector is a unique index that points to a method of a specific class. No, that's not true of Objective-C (although it is of C++ method-pointers