警报OS X应用程序

Dre*_*ors 2 macos cocoa

当我的应用程序中的某个事件被触发时,我必须提示警报.

最好的方法是什么?我无法使用Growl,因为我的应用程序将在Mac App Store上提交,并不意味着用户将使用Growl.

但我想要类似的东西.

充其量,来自iCal的日历活动等提醒.谁能帮我?

Mat*_* S. 8

你的意思是像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];
Run Code Online (Sandbox Code Playgroud)