Re: SELs in arrays
Re: SELs in arrays
- Subject: Re: SELs in arrays
- From: Vince DeMarco <email@hidden>
- Date: Tue, 25 Sep 2001 10:55:53 -0700
On Tuesday, September 25, 2001, at 10:04 am, John C. Randolph wrote:
On Tuesday, September 25, 2001, at 09:48 AM, Robert S Goldsmith wrote:
Hi :)
I have a problem that would be best solved by creating an NSArray
holding a number of different objects - arrays, numbers etc. which can
act as a blueprint for configuring a number of instances of a class. The
problem is that part of the class instance 'blueprint' is which methods
to use. Currently, these are stored in a normal C array and can change
at any time so I can't just build them in or index them in any way. I
need to send these SEL's along with the rest of the blueprint so would
like to be able to simply add the SEL to an array. Is this possible? Can
a SEL pretend to be something else? Can anyone think of another way?
Don't store selectors, store strings:
SEL NSSelectorFromString(NSString *aSelectorName)
NSString *NSStringFromSelector(SEL aSelector)
You could also store a bunch of NSInvocations and just invoke them on
whatever object you want latter.
vince