[英]NSOutlineView with badge of unread messages like Mail.app
I'm trying to create a user interface similar to the iTunes source list or the Mail.app mailbox list where a badge with a number (eg unread emails, new podcasts) is shown at the right hand side of an element. 我正在尝试创建类似于iTunes源列表或Mail.app邮箱列表的用户界面,其中带有数字的徽章(例如,未读电子邮件,新播客)显示在元素的右侧。
Based on Apple's SourceList example, I have an NSOutlineView
set up to display a couple of groups and a few items in each group. 根据Apple的SourceList示例,我设置了一个
NSOutlineView
来显示每组中的几个组和几个项目。
Is there a standard UI element to represent the "badge" with a number for each entry? 是否有标准的UI元素来表示“徽章”,每个条目都有一个数字? I could not find anything in the docs.
我在文档中找不到任何内容。 I suspect I will have to extend
NSTextFieldCell
and do the drawing myself. 我怀疑我必须扩展
NSTextFieldCell
并自己完成绘图。
Are there any examples out there of how to do this? 有没有关于如何做到这一点的例子?
我已经使用了PXSourceList
的PXSourceList,并且发现它非常适合做你想要的。
Apple has example code where they implement the unread badge using a rounded rect button. Apple有示例代码,他们使用圆角矩形按钮实现未读徽章。
See Sidebar Demo . 请参阅侧栏演示 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.