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 cale开发者_运维技巧ndar events from iCal. Can anyone help me?
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];
精彩评论