Skip navigation.
 
mlRe: NSMatrix
FROM : Erik Buck
DATE : Wed Mar 26 21:42:58 2008

Wow!  Dave Hersey wrote a very detailed and comprehensive post that must have taken a long time.  Sadly, I disagree with almost all of it.

NSMatrix is an "older" class that predates the "data source" design pattern that emerged (i think) in NeXTstep 3.0 in about 1994 as I recall.  I think NSMatrix was in Nextstep 0.8 in 1988.

I highly discourage sub-classing NSMatrix.

To use NSMatrix...
Before adding any rows or columns to your matrix, set it's cell class with setCellClass: or its prototype cell with – setPrototype: but don't do both.

Add rows with – addRow and add columns with -addColumn until you have enough cells for all of your data.  Then loop through the rows and columns calling – cellAtRow:column: and configuring each cell based on your data.



The better approach is to use NSCollectionView in Leopard. http://developer.apple.com/documentation/Cocoa/Reference/NSCollectionView_Class/Introduction/Introduction.html

NSCollectionView is much more flexible and more supportive of MVC design using less overall code.

Related mailsAuthorDate
mlNSMatrix Matthew Miller Mar 26, 16:52
mlRe: NSMatrix Dave Hersey Mar 26, 19:40
mlRe: NSMatrix Erik Buck Mar 26, 21:42
mlRe: NSMatrix Dave Hersey Mar 26, 22:08