如何将 NSPredicateEditor/NSRuleEditor 背景设置为交替行?
我看到一些应用程序在其谓词编辑器中使用交替行背景,但我不知道他们是如何做到这一点的。
I've seen some apps are using alternating rows background in their predicate editors, but I can't figure out how they do it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
其中大多数早于 NSPredicateEditor,有些(例如 iTunes 中的)甚至不是 Cocoa。有些可能是带有非常复杂的自定义单元格的 NSTableViews 或 NSOutlineViews;其他的可能是完全自定义的,直接从 NSView 继承而来。
如果无法告诉 NSPredicateEditor 执行此操作或可靠地子类 NSPredicateEditor 执行此操作(即使它具有可以重写以自定义其绘图的私有方法,但不能依赖现有的方法),这些是唯一的方法。
我认为这不值得。 NSPredicateEditor 和 NSRuleEditor 为您提供了很多免费或几乎免费的功能,它们的默认外观可能是 Apple 希望这些视图在未来所有应用程序中的外观。在这种情况下,我说最好是顺其自然。
Most of them pre-date NSPredicateEditor, and some (such as the one in iTunes) aren't even Cocoa. Some may be NSTableViews or NSOutlineViews with very complicated custom cells; others may be fully custom, descending directly from NSView.
Without being able to tell NSPredicateEditor to do it or reliably subclass NSPredicateEditor to do it (even if it has private methods you can override to customize its drawing, you can't rely on those existing), those are the only ways.
I don't think it's worth it. NSPredicateEditor and NSRuleEditor give you a lot of functionality for free or nearly so, and their default appearance is probably how Apple wants those views to look in all apps in the future. In this case, I say it's best to go with the flow.