【问题标题】:NSAlert - can you have a custom icon?NSAlert - 你能有一个自定义图标吗?
【发布时间】:2011-05-30 03:47:30
【问题描述】:

有没有办法在 NSAlert 中插入自定义图标?我知道你可以有不同的 prefabbealert 风格,但有可能 cu

【问题讨论】:

    标签: objective-c cocoa nsalert


    【解决方案1】:

    斯威夫特:

    let alert = NSAlert()
    alert.messageText = "My message"
    alert.addButton(withTitle: "OK")
    alert.alertStyle = .informational
    alert.icon = img
    alert.runModal()
    

    【讨论】:

      【解决方案2】:

      是的。你可以使用

      - (void)setIcon:(NSImage *)icon
      

      查看文档。

      【讨论】:

        猜你喜欢
        • 2014-10-11
        • 1970-01-01
        • 1970-01-01
        • 2018-06-05
        • 2015-09-21
        • 1970-01-01
        • 2021-03-21
        • 2012-07-04
        • 1970-01-01
        相关资源
        最近更新 更多