Mark
Mark

Reputation: 1447

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 (e.g. 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?

Upvotes: 4

Views: 1190

Answers (3)

Mike Lischke
Mike Lischke

Reputation: 53407

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

enter image description here

Upvotes: 1

Stefan
Stefan

Reputation: 91

Apple has example code where they implement the unread badge using a rounded rect button.

See Sidebar Demo.

Upvotes: 2

Dave DeLong
Dave DeLong

Reputation: 243156

I've used PXSourceList by @Perspx and have found it to be excellent for doing exactly what you want.

Upvotes: 4

Related Questions