NSDraggingImageComponent Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/AppKit.framework
Availability
Available in OS X v10.7 and later.
Companion guide
Declared in
NSDraggingItem.h
Related sample code

Overview

The NSDraggingImageComponent class represents a single object in a dragging item.

An array of NSDraggingImageComponent instances are composited together to create the dragging image for an NSDraggingItem. NSDraggingImageComponent instances can simply be considered as named images with a location used by an NSDraggingItem instance.

See NSDraggingItem Class Reference for more information.

Tasks

Creating a Dragging Image Component

Dragging Image Component

Dragging Image Contents

Properties

contents

An object providing the image contents of the component.

@property(retain) id contents
Discussion

Typically you set an NSImage instance or a CGImageRef as content.

Availability
  • Available in OS X v10.7 and later.
Declared In
NSDraggingItem.h

frame

The coordinate space is the bounds of the parent dragging item.

@property NSRect frame
Discussion

The frame is {{0,0}, {draggingFrame.size.width, draggingFrame.size.height}}.

The coordinate space is the bounds of the parent NSDraggingItem instance’s draggingFrame.

Availability
  • Available in OS X v10.7 and later.
See Also
Declared In
NSDraggingItem.h

key

The unique name of this image component instance.

@property(copy) NSString *key
Discussion

The key must be unique for each component in an NSDraggingItem instance. You can create your own named components, however the keys described in “NSDragImage Component Keys” have special meanings.

When an NSDraggingItem instances imageComponents are changed by one of the enumerateDraggingItemsWithOptions:forView:classes:searchOptions:usingBlock: methods the image associated with this key is morphed into the new image component’s image associated with the same key.

Availability
  • Available in OS X v10.7 and later.
Declared In
NSDraggingItem.h

Class Methods

draggingImageComponentWithKey:

Creates and returns a dragging image component with the specified key.

+ (id)draggingImageComponentWithKey:(NSString *)key
Parameters
key

The key.

Return Value

A dragging image component with the spiced key.

Availability
  • Available in OS X v10.7 and later.
Declared In
NSDraggingItem.h

Instance Methods

initWithKey:

Initializes and returns a dragging image component with the specified key.

- (id)initWithKey:(NSString *)key
Parameters
key

The key.

Return Value

An initialized dragging image component with the specified key.

Discussion

This method is the designated initializer.

Availability
  • Available in OS X v10.7 and later.
Declared In
NSDraggingItem.h

Constants

NSDragImage Component Keys

These constants are used by the initWithKey:, draggingImageComponentWithKey: methods and the key property.

NSString * const NSDraggingImageComponentIconKey; NSString * const NSDraggingImageComponentLabelKey;
Constants
NSDraggingImageComponentIconKey

Key with a corresponding value that is an image of the item being dragged.

Available in OS X v10.7 and later.

Declared in NSDraggingItem.h.

NSDraggingImageComponentLabelKey

Key with a corresponding value that represents a textual label associate with the item, for example, a file name.

Available in OS X v10.7 and later.

Declared in NSDraggingItem.h.