• 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: Subclassing views
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Subclassing views


  • Subject: Re: Subclassing views
  • From: Lorenzo <email@hidden>
  • Date: Tue, 04 May 2004 08:41:13 +0200

Hi,
thank you for your fast reply.
The problem is that the post-it could be a picture, a movie, a text... So if
it is a movie I should add a NSMovieView over the first image and I don't
know how to refresh the movie view within the drawRect method of the
NSImageView. Also it sounds a little bit strange.
I think that I should define the main class as NSView. Then I put within
this object all the subviews I want, e.g. the first NSImageView as
background, and over this I put another NSImageView or NSMovieView or
NSTextView.

Only, since I have to redefine the main and big class, I ask to myself how
fast will be redrawing such an incapsulate object.
Any idea about that?


Best Regards
--
Lorenzo
email: email@hidden

> From: James Chen <email@hidden>
> Date: Tue, 04 May 2004 09:33:08 +0800
> To: Lorenzo <email@hidden>
> Cc: email@hidden
> Subject: Re:Subclassing views
>
> 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.


References: 
 >Re:Subclassing views (From: James Chen <email@hidden>)

  • Prev by Date: Updated Apple Documentation Online - New ADC Binding Article too
  • Next by Date: Re: Types of Windows
  • Previous by thread: Re:Subclassing views
  • Next by thread: NSView and backgrounds, selectable
  • Index(es):
    • Date
    • Thread