可可的自定义列表控件 [英] custom list control in cocoa
问题描述
我想尝试在此屏幕截图中显示
在可可,我的意思是一个自定义列表控件。
预先感谢您的帮助,
,
更新:
NSTableView现在支持可变高度的基于视图的行:
- (NSTableViewRowSizeStyle)rowSizeStyle
返回值
行样式样式。
讨论。
请参阅NSTableViewRowSizeStyle
行大小样式可以通过调用委托方法tableView:heightOfRow:
(如果已实现),逐行修改。
rowSizeStyle
默认为NSTableViewRowSizeStyleCustom
。NSTableViewRowSizeStyleCustom
表示使用表的rowHeight,而不是预先确定的系统值。
除了源列表之外,code> rowSizeStyle 应始终为
NSTableViewRowSizeStyleCustom
。要实现可变行高,请将值设置为NSTableViewRowSizeStyleCustom
,并在代理中实现tableView:heightOfRow:
。 >
可用性
适用于OS X v10.7及更高版本。
原始答案:
更现代的视图黑客NSTableView将是以下之一:
http://github.com/sdegutis/SDListView
SDListView - 克隆NSCollectionView,但使用
变量高度项目,并且只使用
单列。
http://github.com/uliwitness/PXListView
PXListView - Mac的优化列表视图控制
OS X 10.5及更高版本。在我写了这篇文章后,创建了
。 / a>
主题。
PXListView使用新的
BSD许可证授权。
PXListView使用类似的优化
作为UITableView用于iPhone,
将NSViews入队和出列队列,
用于显示行,以便
保持低内存占用当
是
列表中的大量行时,仍然允许每一行到
由NSView表示,这比
比处理单元格更容易。 p>
控制的体系结构是
,基于列表视图控制哪些
存在于Tweetie(Mac)和
Echofon(Mac )。
该项目仍然是一个工作
正在进行中,因此没有
文档存在当前。
I am trying to get something like in this screenshot
in cocoa, I mean a custom list control. Do you know how this kind of things can be done?
Thanks in advance for your help,
Regards,
Update:
NSTableView now supports view-based rows with variable heights:
- (NSTableViewRowSizeStyle)rowSizeStyle
Return Value
The row style style. SeeNSTableViewRowSizeStyle
for the supported options.Discussion
The row size style can be modified on a row by row basis by invoking the delegate methodtableView:heightOfRow:
, if implemented.The
rowSizeStyle
defaults toNSTableViewRowSizeStyleCustom
.NSTableViewRowSizeStyleCustom
indicates to use the rowHeight of the table, instead of the pre-determined system values.Generally,
rowSizeStyle
should always beNSTableViewRowSizeStyleCustom
except for "source lists". To implement variable row heights, set the value toNSTableViewRowSizeStyleCustom
and implementtableView:heightOfRow:
in the delegate.Availability
Available in OS X v10.7 and later.
Original Answer:
An approach, that's more modern than view hacking NSTableView would be either one of these:
http://github.com/sdegutis/SDListView
SDListView - Clone of NSCollectionView, but with variable-height items and only using a single column.
http://github.com/uliwitness/PXListView
PXListView - An optimized list view control for Mac OS X 10.5 and greater. It was created after I wrote this post on the subject.
PXListView is licensed under the New BSD license.
PXListView uses similar optimizations as UITableView for the iPhone, by enqueuing and dequeuing NSViews which are used to display rows, in order to keep a low memory footprint when there are a large number of rows in the list, yet still allowing each row to be represented by an NSView, which is easier than dealing with cells.
The architecture of the control is based on the list view controls which are present in both Tweetie (Mac) and Echofon (Mac).
The project is still very much a work in progress, and as such no documentation exists at current.
[Edit: it case it wasn't obvious: the class descriptions seen above are quotations of course ;) Where "I" in the latter one actually refers to "Alex Rozanski", not me.]
这篇关于可可的自定义列表控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!