简体   繁体   中英

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.

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.

Is there a standard UI element to represent the "badge" with a number for each entry? I could not find anything in the docs. I suspect I will have to extend NSTextFieldCell and do the drawing myself.

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.

See Sidebar Demo .

Since a while there is a special inline button in the object library:

在此输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM