Re:Subclassing views
Re:Subclassing views
- Subject: Re:Subclassing views
- From: James Chen <email@hidden>
- Date: Tue, 4 May 2004 09:33:08 +0800
Hi,
I don't see any problem in this approach.
But, do the subview you add to draw the post-it has the chance to draw
itself during the dragging?
I think it is the point you could check.
Or maybe you could try to draw the post-it image in your subclass
MYPostit.
- (void)drawRect:(NSRect)rect
{
[super drawRect:rect];
// and your overlay drawing here
}
HTH,
James
------------------------------------
Ulead Systems Inc.
James Chen
Software Engineer
Image Div.
------------------------------------
On May 4, 2004, at 5:33 AM, Lorenzo wrote:
Hi,
I have just subclassed an NSImageView (MYImageView) because I need some
special behaviour by it. I wrote a lot of code.
Now I realized that I need a class very similar to MYImageView, with
some
features more, so I tried to subclass MYImageView, thus I created the
class
MYPostit.
In this class I need to see the original image defined in the
superclass,
plus a new image which I drag over it. Just like attaching a post-it.
So, in MYPostit I tried to add a subview to self
([self addSubview:postitImageView]), but it didn't work well. I see the
MYImageView image over all, and not the MYPostit over the MYImageView
image.
So now I am thinking that the first class MYImageView should have been
a
subclass of NSView and not a subclass of NSImageView. So this way, I
can add
all the NSImageView I want.
Right? Or, should I use a different solution?
Best Regards
--
Lorenzo
email: email@hidden
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.