如何在没有任何图标的情况下使用NSAlert?

时间:2013-04-10 12:12:34

标签: ios macos cocoa nsalert

我想在NSAlertbeginSheetModalForWindowNSWarningAlertStyle中使用NSInformationalAlertStyle创建一个NSCriticalAlertStyle,而在NSBeginAlertSheetNSBeginCriticalAlertSheet中没有任何图标?

此外,如果我使用{{1}},{{1}}等功能API,如何从中删除图标?

2 个答案:

答案 0 :(得分:4)

你可以做一些黑客攻击。

enter image description here

此处使用了transparent image (click to download)

答案 1 :(得分:0)

你不能! NSAlert始终显示应用程序图标:https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/ApplicationKit/Classes/NSAlert_Class/Reference/Reference.html

  

图标:警报的图标。 nil恢复应用程序图标。

     

讨论:   默认情况下,图像是应用程序图标,可通过应用程序包的NSApplicationIcon属性访问。

考虑子类NSAlert或创建自己的对话框。