相关疑难解决方法(0)

NSUserNotification未显示操作按钮

我正在使用此代码:

- (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];
}
Run Code Online (Sandbox Code Playgroud)

我得到了,但没有失败,

在此输入图像描述

没有操作按钮或其他按钮.

cocoa osx-mountain-lion nsusernotification

40
推荐指数
3
解决办法
1万
查看次数

从通知中心删除应用程序

嘿,我正在玩一个小的可可应用程序并在Mountain Lion中使用新的Notification Center API.但是,我的应用程序现在存在于通知中心设置中,以及日历,消息等.

因为只是我在玩,我希望它现在从列表中消失,但我无论如何都找不到它,尝试了几件事,拖出来,按住alt +右键等等.有谁知道填充该列表的(可能是)plist位于何处?

macos osx-mountain-lion nsusernotification

20
推荐指数
5
解决办法
3万
查看次数

为OS X创建交互式通知

Mac基础知识:通知会通知您,可以使用文本输入字段创建交互式警报:

例如,您可以直接通过通知回复聊天.

OS X聊天提醒

我该如何实现它?例如,我有一个通知:

let notification = NSUserNotification.init()
notification.hasActionButton = true
notification.actionButtonTitle = "Agree"
notification.title = "Header"
notification.informativeText = "Text."

NSUserNotificationCenter.default.deliver(notification)
Run Code Online (Sandbox Code Playgroud)

macos notifications nsusernotification swift swift3

3
推荐指数
1
解决办法
2316
查看次数