DreamOfMirrors
DreamOfMirrors

Reputation: 2157

Alert for an OS X application

I have to bring up an alert when a certain event in my app has been fired.

What is the best way to do it? I can not use Growl because my app will be submitted on the Mac App Store and it does not mean that user will use Growl.

But I'd like something similar.

At best, an alert like calendar events from iCal. Can anyone help me?

Upvotes: 2

Views: 3240

Answers (1)

Matt S.
Matt S.

Reputation: 13753

You mean like an NSAlert?

NSAlert *alert = [[[NSAlert alloc] init] autorelease];
[alert addButtonWithTitle:@"OK"];
[alert addButtonWithTitle:@"Cancel"];
[alert setMessageText:@"Delete the record?"];
[alert setInformativeText:@"Deleted records cannot be restored."];
[alert setAlertStyle:NSWarningAlertStyle];
[alert beginSheetModalForWindow:[self window] modalDelegate:self didEndSelector:@selector(alertDidEnd:returnCode:contextInfo:) contextInfo:nil];

Upvotes: 8

Related Questions