如何使用Cocoa在我的Dock图标上绘制徽章? [英] How do I draw a badge on my Dock icon using Cocoa?

查看:117
本文介绍了如何使用Cocoa在我的Dock图标上绘制徽章?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用Cocoa为我的应用程序的Dock图标添加徽章?有没有大致标准化的方式来做到这一点?

How do I add a badge to the Dock icon for my app using Cocoa? Is there any roughly "standardized" way to do this?

(我指的是在Mail,iChat等中显示的徽章类型,以表示未读邮件的数量等)

(I'm referring to the kind of badges that show up in Mail, iChat etc. to indicate the number of unread messages and the like.)

Cocoa Touch提供了一个这样的方法,但是我还没有找到任何等效的Cocoa应用程序。

Cocoa Touch does provide one such method, but I haven't been able to find any equivalent for a regular Cocoa application.

推荐答案

使用

 [[[NSApplication sharedApplication] dockTile] setBadgeLabel:@"2234"];



此方法和 NSDockTile 自Leopard以来一直可用。

This method, and the NSDockTile class, has been available since Leopard.

这篇关于如何使用Cocoa在我的Dock图标上绘制徽章?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆