SEL and NSSelectorFromString
SEL and NSSelectorFromString
- Subject: SEL and NSSelectorFromString
- From: Jason Blake <email@hidden>
- Date: Sat, 19 Jan 2002 20:12:57 -0600
I can't find much documentation for what SEL is, or what the format the
parameter for NSSelectorFromString takes. In particular I have
successfully added menu items to my applications dock menu. however when
building up the menuitems for my menu and using the following:
#import "AppMenuController.h"
@implementation AppMenuController
- (void)awakeFromNib
{
//create menu
SEL action = NSSelectorFromString(@"item1");
appMenu=[[NSMenu alloc] initWithTitle:@"title"];
[appMenu addItem:[ [NSMenuItem alloc] initWithTitle:@"item 1"
action:action keyEquivalent:@""] ];
}
-(void) item1
{
NSLog(@"%@",@"\nItem1 selected");
}
//NSApplication delegate methods
- (NSMenu *)applicationDockMenu:(NSApplication *)sender
{
return appMenu;
}
@end
When running the app "item 1" shows up and is selectable, but when I
select it I get no log message. Can anyone help