开发者

NSTableView with more than one UI element in NSCell (like Transmission)

开发者 https://www.devze.com 2023-02-14 12:07 出处:网络
How would I make an 开发者_Python百科NSCell with more than one UI element in it and display it in an NSTableView? For NSCells with a single value I could implement tableView:objectValueForTableColumn:

How would I make an 开发者_Python百科NSCell with more than one UI element in it and display it in an NSTableView? For NSCells with a single value I could implement tableView:objectValueForTableColumn:row: but I don't know how to do this for NSCells with more than one. At the moment I have an NSView in an NSCollectionView and all the elements are bound to an NSArrayController. But I'd rather have an NSTableView or similar.


I've switched to JAListView for table and outline views in my Mac apps: https://github.com/joshaber/JAListView

It has the advantage of using NSViews for table items instead of NSCells, allowing for greater freedom in implementing your design.

There's a few other alternatives out there too trying to solve similar gaps in NSTableView and its subclasses: http://groups.google.com/group/cocoa-unbound/browse_thread/thread/87b2a1b5725eac05


You return the primary value in the tableView:objectValueForTableColumn:row: method, and then set up the cell further in tableView:willDisplayCell:forTableColumn:row:.

Either that, or you create a custom NSCell subclass that can customize itself based on the objectValue that you give it.

0

精彩评论

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

关注公众号