I am dynamically building menu's based on an array and there is a sub-menu is linked to an IBAction which opens a folder in Finder. The folder it opens is based on a property of the object in my initial array.
Is there a way of linked the NSMenuItem action to the IBAction and passing in this directory variable as I am dynamically creating this array?
OR should I be going into the IBAction and resolving the directory by referencing the NSMenuItem with against array?
e.g.
person = [[Person alloc] init];
// person is assigned
subMenu = [[NSMenu alloc] init];
[subMenu addItemWithTitle:@"Open folder" action:@selector(openDirectory:person.directory) keyEquivalent:@""];