Is there a way to store a selector in an NSDictionary
, without storing it as an NSString
?
SEL
is just a pointer, which you could store in an NSValue
:
NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
[NSValue valueWithPointer:@selector(foo)], @"foo",
nil];
To get the selector back, you can use:
SEL aSel = [[dict objectForKey:@"foo"] pointerValue];