Re: NSMatrix setCellClass: vs setPrototype:
Re: NSMatrix setCellClass: vs setPrototype:
- Subject: Re: NSMatrix setCellClass: vs setPrototype:
- From: Erik Buck <email@hidden>
- Date: Fri, 2 Jun 2006 11:34:53 -0700 (PDT)
A cell prototype is copied as needed to create more cells for display in the matrix. Any copies replicate all of the state configured for the prototype cell such as text alignment, button mode, etc.
The cell class specifies the class used to create new cell instances from scratch as needed for display in the matrix. Newly created instances typically have default state values such as left aligned text and momentary push for buttons etc.
If you care about the initial state of cells, set a prototype to be copied. If not, just set the cell class.
If this distinction is not clear in Apples documents, you should file a bug report against the documents.
See also the Prototype design pattern. (Why isnt this pattern mentioned in Apples documentation about design patterns used in Cocoa ?)
See http://www.mindspring.com/~mgrand/pattern_synopses.htm#Prototype
The Factory Method pattern is not needed with Objective-C because class objects are regular objects that can be stored in a variable. The goal of the Factory Method pattern is met by just setting the cell class for the matrix to use. Some other languages treat class as a compile-time only construct and there is no way to store a class in a variable in such languages.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden