【发布时间】:2012-07-25 10:28:15
【问题描述】:
我正在使用此代码:
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
// Insert code here to initialize your application
NSUserNotification *notification = [[NSUserNotification alloc] init];
[notification setTitle: @"Title"];
[notification setSubtitle: @"Subtitle"];
[notification setInformativeText: @"Informative Text"];
[notification setHasActionButton: YES];
[notification setActionButtonTitle: @"Action Button"];
[notification setOtherButtonTitle: @"Other Button"];
[notification setSoundName: NSUserNotificationDefaultSoundName];
[notification setDeliveryDate: [NSDate dateWithTimeIntervalSinceNow: 10]];
[[NSUserNotificationCenter defaultUserNotificationCenter] scheduleNotification: notification];
}
我得到了,没有失败,
没有操作按钮,或其他按钮。
【问题讨论】:
-
我无法在 Patrick 的答案下方添加 cmets,因为我只是 stackoverflow 中的一个新人,但是@Dorian,您可以在这里查看我的答案stackoverflow.com/questions/16029755/… 屏幕在系统偏好设置中。
标签: cocoa osx-mountain-lion nsusernotification