在 NSTableView 和 NSOutlineView 之间进行选择
我真的很想创建一个与显示的屏幕类似的分段表格视图 (这是从 XCode->Build Phases 视图)。老实说,我有点不知道如何开始。
我可以使用 NSTableView + 自定义 NSTableCellView 来管理扩展/折叠行为,但我完全不确定是否可以或允许调整单个行的大小(这里的文档并不太详细)。
第二种方法是选择 NSOutlineView 来完成此行为,但它需要一些认真的子类化才能到达我想要去的地方。
那么,在我再次犯错之前,你会做什么?非常感谢您抽出时间
– 莫里茨
I'd really like to create a table view that is segmented similar to the screen shown ( which is taken from the XCode->Build Phases view ). To be honest, I'm a bit lost on how to start there.
I could use a NSTableView + a custom NSTableCellView that manages the expanding/collapsing behaviour, but I'm entirely not sure if the resizing of an individual row is possible or permitted ( the doc isn't too verbose here ).
The second approach would be to choose a NSOutlineView to accomplish this behaviour, yet it would require some serious subclassing to get where I'd like to go.
So, before I'm doing it wrong again, what would you do? Thanks a lot for your time
– Moritz
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我很确定这是一个 NSOutlineView (不确定是一个大轮廓还是 4 个)。子类化并不像看起来那么难。唯一需要自定义绘图的项目是根元素(即带有显示三角形的行。)
I am quite sure that is an NSOutlineView (not sure if is one big outline or 4). The subclassing isn't as hard as it looks. The only item that requires custom drawing is the root element (that's the row with the disclosure triangle.)