I create a menu programmatically:
+ (void)refreshStatusMenu {
for (NSDictionary *dict in kbMsgSet) {
NSString *msj = [dict objectForKey:@"msj"];
NSString *mid = [dict objectForKey:@"mid"];
msg_item = [[NSMenuItem alloc] initWithTitle:[NSString stringWithFormat:@"%@", msj] action:@selector(goToURL:mid:) keyEquivalent:@""];
[msg_item setTarget:[self class]];
[sm insertItem:msg_item atIndex:(i_msg)];
i_msg++;
}
}
How to pass a parameter @selector(goToURL:), so when I click on an element I could call:
+ (void)goToURL:(id)obj {
NSLog(@"Open url:...%@", obj);
}
If I try to pass @selector(goToURL:var2:), I get an uncaught exception error.
source
share