• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Using NSInvocation with a class method
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using NSInvocation with a class method


  • Subject: Re: Using NSInvocation with a class method
  • From: Christian Brunschen <email@hidden>
  • Date: Wed, 23 Nov 2005 16:42:06 +0000


On 23 Nov 2005, at 16:26, Brant Sears wrote:

I would like to use an NSInvocation object to invoke a class method. In this case, it is the method + (void) setHiddenUntilMouseMoves:(BOOL)flag on the class NSCursor. The reason is that I would like to be able to invoke this from a timer.

I am trying the following:
NSMethodSignature * methodSig = [NSCursor instanceMethodSignatureForSelector:@selector (setHiddenUntilMouseMoves:)];


methodSig returns nil in this case. I am guessing that perhaps this method is not appropriate for a class method because of the word "instance" in the name. On the other hand, I do not see a call that looks more apporpriate for creating the NSMethodSignature necessary to create the NSInvocation object.

Can someone please explain how to go about creating an NSInvocation object for a class method?

Class objects for subclasses of NSObject respond to all messages that you can send to an instance of NSObject - among them,


- (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector

Just change your code to

NSMethodSignature * methodSig = [NSCursor methodSignatureForSelector:@selector(setHiddenUntilMouseMoves:)];

which will ask the NSCursor class object for the method signatore for the selector 'setHiddenUntilMouseMoves:', which in this case will be a class method.

Thanks.

Best wishes,

Brant Sears

// Christian Brunschen


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Using NSInvocation with a class method (From: "Brant Sears" <email@hidden>)

  • Prev by Date: Re: Xcode 2.1 debugging
  • Next by Date: Fade out effect with a NSView
  • Previous by thread: Using NSInvocation with a class method
  • Next by thread: NSApp sendAction
  • Index(es):
    • Date
    • Thread