How do I draw a badge on my Dock icon using Cocoa?
问题 How do I add a badge to the Dock icon for my app using Cocoa? Is there any roughly "standardized" way to do this? (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 does provide one such method, but I haven't been able to find any equivalent for a regular Cocoa application. 回答1: Use [[[NSApplication sharedApplication] dockTile] setBadgeLabel:@"2234"]; This method, and the NSDockTile class, has been