• 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: nsbitmapimagerep from nsview subclass, obtaining and drawing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: nsbitmapimagerep from nsview subclass, obtaining and drawing


  • Subject: Re: nsbitmapimagerep from nsview subclass, obtaining and drawing
  • From: "Cathy Shive" <email@hidden>
  • Date: Wed, 1 Aug 2007 12:22:05 -0400

Definitely use the built in drag and drop funcitonality!!!

When the user drags in the view, get an NSImage with the contents of
the view.  If you want it to be semi-transparent, you'll need to
composite the image with another image.  it'll look something like
this:

[aDragImage setBackgroundColor:[NSColor clearColor]];
[aDragImage lockFocus];
[aCurrentViewImage dissolveToPoint:NSZeroPoint fraction:.5];
[aDragImage unlockFocus];

I'm sure there are different approaches you can take to get the transparency.

Now use this image as your drag image. Look at NSView's documentation
for dragImage:at:offset:event:pasteboard:source:slideBack:

As far as altering the view heirarchy, you'll have to be creative.
You probably don't want the view to be removed as soon as the user
starts dragging.  Maybe after they drop it in the desired spot.  It's
totally up to you to design something that makes sense.

You're going to need to read this:
http://developer.apple.com/documentation/Cocoa/Conceptual/DragandDrop/index.html

Good luck!

On 8/1/07, I. Savant <email@hidden> wrote:
> On 8/1/07, I. Savant <email@hidden> wrote:
> > 1 - Using typical d-n-d methods, first retain and remove the the
> > dragged subview from its superview (so it's not in two places at
> > once).
>
>   A clarification: Ignore the "using typical d-n-d methods" part of
> that step ... that phrase was meant for the entire approach, which I
> originally hadn't mentioned in the preceding paragraph.
>
> --
> I.S.
> _______________________________________________
>
> 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
>
_______________________________________________

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: 
 >nsbitmapimagerep from nsview subclass, obtaining and drawing (From: David Harper <email@hidden>)
 >Re: nsbitmapimagerep from nsview subclass, obtaining and drawing (From: "I. Savant" <email@hidden>)
 >Re: nsbitmapimagerep from nsview subclass, obtaining and drawing (From: "I. Savant" <email@hidden>)

  • Prev by Date: [MEET] August CocoaHeads Mac Developer Meetings
  • Next by Date: Re: Usefulness of a Cocoa DSP framework?
  • Previous by thread: Re: nsbitmapimagerep from nsview subclass, obtaining and drawing
  • Next by thread: Where should I put data versioning code?
  • Index(es):
    • Date
    • Thread