Thanks very much for your input guys. David: I had carefully read the Categories and Extensions page in OBJ-C Programming Language. And, based on the first paragraph, assumed I could add functionality to drawRect for my particular case. Stephen: In my app there is only the one NSMatrix instance but it's true I've no idea what other Cocoa classes will call my drawRect. Although I do [super drawRect] after my own drawing. Jens: I am aware of the difference between the matrix and it's cells. For the matrix I want to do some special drawing of the background beyond filling, including stroking the bounds. I also need to deal with placing the cells differently than the default. I want to inset them differently. But that's the next thing to play with. Anyway guys thanks for your kindness and contribution to my education. I will return to the mountain to meditate some more. respect…. Peter On 2012-03-31, at 10:24 AM, David Duncan wrote:
On Mar 30, 2012, at 8:31 PM, Peter Teeson <pteeson@me.com> wrote:
In a Document app I have an NSMatrix. I only need to override drawRect. Rather than using a sub-class, which seems overkill to me, I decided to try a Category instead.
Categories don't override, they replace. As has already been noted , this means every NSMatrix instance in your app now uses your drawRect:. But it also means you can't have two instances of NSMatrix that had different drawing and you can no longer access the original implementation. -- David Duncan
_______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/site_archiver%40lists.appl... This email sent to site_archiver@lists.apple.com