I have a question on how to use a selector with multiple parameters. I need to toggle this:
-(void)openBackupNamed:(NSString *)name
using this:
[backupList addItemWithTitle:file action:@selector(openBackupNamed:) keyEquivalent:@""];
I know that there is the withObject: parameter for these cases, but I can’t do this in the addItemWithTitle:action:keyEquivalent: method or am I missing something?
Thanks
In your case you will have to create a new NSInvocation object and set it’s index 2 parameter to your NSString (The 0- and 1-indexed parameters are reserved).
Example:
Read the ADC NSInvocation Class Reference
Please mind the
setArgumentmessage. You have to pass it the address of your parameter (your string), not the actual object itself.