NSOutlineView 带有未读消息的标记,例如 Mail.app

发布于 2024-09-26 03:36:00 字数 267 浏览 1 评论 0原文

我正在尝试创建一个类似于 iTunes 源列表或 Mail.app 邮箱列表的用户界面,其中带有数字的徽章(例如未读电子邮件、新播客)显示在元素的右侧。

基于 Apple 的 SourceList 示例,我设置了一个 NSOutlineView 来显示几个组以及每个组中的一些项目。

是否有一个标准的 UI 元素来表示“徽章”,每个条目都有一个数字?我在文档中找不到任何内容。我怀疑我必须扩展 NSTextFieldCell 并自己绘制。

有没有关于如何执行此操作的示例?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

趁年轻赶紧闹 2024-10-03 03:36:00

我使用过 @Perspx 的 PXSourceList 并发现它非常适合做你想做的事。

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

微凉徒眸意 2024-10-03 03:36:00

苹果有示例代码,他们使用圆角矩形按钮实现未读徽章。

请参阅侧边栏演示

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

See Sidebar Demo.

夏日落 2024-10-03 03:36:00

一段时间以来,对象库中有一个特殊的内联按钮:

在此处输入图像描述

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

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文