Reputation: 1344
Is there any example for showing a hello world notification on Mountain Lion OSX 10.8 (the new notification center).
Just to add visual clarity here is what I am talking about:
Upvotes: 16
Views: 4472
Reputation: 16024
Look up NSUserNotification
and NSUserNotificationCenter
.
Upvotes: 10
Reputation: 1344
I finally found answer after a little help from @Alexsander.
NSUserNotification *notification = [[NSUserNotification alloc] init];
[notification setTitle:@"Hello World"];
[notification setInformativeText:@"Hello world message"];
[notification setDeliveryDate:[NSDate dateWithTimeInterval:20 sinceDate:[NSDate date]]];
[notification setSoundName:NSUserNotificationDefaultSoundName];
NSUserNotificationCenter *center = [NSUserNotificationCenter defaultUserNotificationCenter];
[center scheduleNotification:notification];
Hope it helps people
Upvotes: 43