views:

40

answers:

1

Guys, any thoughts how create interface elements as tasks in Things application ? is it Nstableview?

A: 

Things appears to use its own custom view.

If all the items in your collection were all the same size, you could easily do this with NSCollectionView and an NSCollectionViewItem subclass with a custom background. Since they're variable height, though, you have to roll your own.

Essentially, you want a container view whose job it is to lay out the subviews. You want a custom subview that can handle the collection of controls. You'd instantiate a new "prototype" view for each item in the container view. the container view will, upon any significant change (additions/subtractions, subview size changes, window resize ...), "tile" the view.

The simplest tiling is simply to roll through each view, lining it up to its height for the given width, then line up the next one after it... You'll want to consider performance, though, for large collections. In this case, there are various approaches to caching that have been described here and there on the usual Cocoa channels.

I do this very thing in one of my products - have since roughly 2004, making steady performance improvements through caching pre-drawn representations of an "entry", using a "real" entry view only for the one being edited by the user. In other words, getting the basics working is easy, but squeezing good performance out of a large collection gets steadily harder. :-)

Joshua Nozzi