• 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: Calling a method based on a string
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Calling a method based on a string


  • Subject: Re: Calling a method based on a string
  • From: Lee Morgan <email@hidden>
  • Date: Mon, 11 Oct 2004 23:27:49 -0400

Wow so many replies so little time...
First off thanks for the timely help.
Secondly, I have little need to pass anything aside from objects; rects and other structs can easily be made into objects, and for my needs I'll probably have to do so anyways.

I'm going to be calling performSelector hundreds of times per second so....anyone have a general idea about how much of a performance hit using performSelector is? I can probably cache the selector so that I don't have to call NSSelectorFromString every time.

This is a rough example of what I'll be calling...

[[myDict objectForKey:@"akey"] performSelector:[actionDict objectForKey:@"drawRect"] withObject:[ [myDict objectForKey:@"akey"] objectForKey:@"myDrawRect"];

I realize its highly indirect, but I haven't found any other way to call a method in a object when all I know is the string name of the method, also the objects are created dynamically so I don't have a direct ptr to them, only a reference in either a array or dictionary.

I hope that made sense; I'm still trying to get it to make sense to me :-)

- lee

_______________________________________________
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: 
 >Re: Calling a method based on a string (From: "Martin" <email@hidden>)

  • Prev by Date: Re: modal window stack
  • Next by Date: Re: IB and NSSplitView headaches
  • Previous by thread: Re: Calling a method based on a string
  • Next by thread: Add a point to a NSBezierPath
  • Index(es):
    • Date
    • Thread