NSSelectorFromString oddity
NSSelectorFromString oddity
- Subject: NSSelectorFromString oddity
- From: Bruce Truax <email@hidden>
- Date: Wed, 10 Nov 2004 22:22:58 -0500
I am attempting to use the NSSelectorFromString function to create a
selector. I have used this numerous times before and it has always worked
but something odd is happening this time. In this program thPikup is a
getter for a pointer to an object.
If I use:
pikupSelector = NSSelectorFromString(@"thPikup");
if ([lensSurface respondsToSelector:pikupSelector]){
thePikup = [lensSurface thPikup];
thePikup = [lensSurface performSelector:pikupSelector];
Then thPikup is the same for the last two lines. If I use:
selectorString = [[NSString alloc] initWithString:@"thPikup"];
pikupSelector = NSSelectorFromString(pikupString);
if ([lensSurface respondsToSelector:pikupSelector]){
thePikup = [lensSurface thPikup];
thePikup = [lensSurface performSelector:pikupSelector];
Then the first thPikup is the pointer to the correct object and the second
thPikup is a pointer to the lensSurface object. The weird thing is that the
test -respondsToSelector succeeds for both cases.
Does anyone see what is wrong?
Bruce
--
____________________________________________________________
Bruce E. Truax email: email@hidden
Optical Engineering Consultant
Diffraction Limited Design LLC
388 Wedgewood Road voice: 860-276-0450
Southington, CT 06489 fax: 860-620-9026
http://www.dld-llc.com
_____________________________________________________________
_______________________________________________
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