开发者

custom list control in cocoa

I am trying to get something like in this screenshot

custom list control in cocoa

(source: s开发者_开发知识库mokingapples.com)

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. See NSTableViewRowSizeStyle for the supported options.

Discussion
The row size style can be modified on a row by row basis by invoking the delegate method tableView:heightOfRow:, if implemented.

The rowSizeStyle defaults to NSTableViewRowSizeStyleCustom. NSTableViewRowSizeStyleCustom indicates to use the rowHeight of the table, instead of the pre-determined system values.

Generally, rowSizeStyle should always be NSTableViewRowSizeStyleCustom except for "source lists". To implement variable row heights, set the value to NSTableViewRowSizeStyleCustom and implement tableView: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.]


This is a simple NSTableView with a redrawn table cell which consists of NSImageView and a fiew customized NSTextFields.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜