开发者

NSAlert - can you have a custom icon?

Is the开发者_运维技巧re a way to insert a custom icon in a NSAlert? I know you can have different prefabbealert styles but is it possible to cu


Yes. You can use

- (void)setIcon:(NSImage *)icon

Look at the documentation.


Swift:

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜