Skip to content

Instantly share code, notes, and snippets.

@linkesch
Last active December 26, 2015 07:29
Show Gist options
  • Save linkesch/7115200 to your computer and use it in GitHub Desktop.
Save linkesch/7115200 to your computer and use it in GitHub Desktop.
Cocoa - notifications with OS X Notification Center - http://stackoverflow.com/a/11815544/291500
- (IBAction)showNotification:(id)sender{
NSUserNotification *notification = [[NSUserNotification alloc] init];
notification.title = @"Hello, World!";
notification.informativeText = @"A notification";
notification.soundName = NSUserNotificationDefaultSoundName;
[[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification:notification];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment