0

I have a NSAlert in XCode5

NSAlert *alert = [[NSAlert alloc] init];

    [alert setMessageText:@"Notificación"];
    [alert setInformativeText:mensaje];
    [alert setAlertStyle:NSInformationalAlertStyle];
    [alert beginSheetModalForWindow:window modalDelegate:nil
                     didEndSelector:@selector(myMethod})
                        contextInfo:nil];

as you see on didEndSelector I have a section for adding a method, is it possible to create there inside a custom method for making just an action, for instance something like this

[alert beginSheetModalForWindow:window modalDelegate:nil
                     didEndSelector:@selector(myCustomMethod{NSLog(@"hola");})
                        contextInfo:nil];

this is for saving the time of adding tons of methods one for each NSAlert

thanks in advance for the support

Jesus
  • 8,456
  • 4
  • 28
  • 40

1 Answers1

0

create separated method with some NSLOG for example

- (void)logs {
   NSLog(@"lalalalalal")
}

Then send it to selector:

@selector(logs)

If your method receiving some variable, your select should be like:

@selector(logs:)
Anton
  • 3,102
  • 2
  • 28
  • 47
  • what I want is to avoid separate method creation, because I have a lot of NSAlerts there, so I want to declarate the method there inside of each NSAlert, is there a way to do that?? – Jesus Jul 07 '14 at 16:05