• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: drawRect using a Category
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: drawRect using a Category


  • Subject: Re: drawRect using a Category
  • From: Peter Teeson <email@hidden>
  • Date: Sat, 31 Mar 2012 21:46:52 -0400

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 <email@hidden> 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 (email@hidden)

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:

This email sent to email@hidden


References: 
 >drawRect using a Category (From: Peter Teeson <email@hidden>)
 >Re: drawRect using a Category (From: David Duncan <email@hidden>)

  • Prev by Date: Re: drawing lines in and NSTextView
  • Next by Date: Re: NSDocument disc undo stack
  • Previous by thread: Re: drawRect using a Category
  • Next by thread: Problem with NSScrollView and scroll bars
  • Index(es):
    • Date
    • Thread