NSUserNotification不显示操作按钮 [英] NSUserNotification not showing action button
本文介绍了NSUserNotification不显示操作按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用这段代码:
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
//在这里插入代码来初始化应用程序
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];
}
b
>
无操作按钮或其他按钮。
解决方案
这是答案。
再次感谢#macdev的freenode。
选择需要提醒才能有按钮。
I'm using this code:
- (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];
}
And I'm getting, without fail,
No action button, or other button.
解决方案
And here was the answer.
Thanks again to #macdev on freenode.
The selection needs to be "Alerts" to have buttons.
这篇关于NSUserNotification不显示操作按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文