Mac Developer Library

Developer

AppKit Framework Reference NSDraggingImageComponent Class Reference

Options
Deployment Target:

On This Page
Language:

NSDraggingImageComponent

Inheritance


Conforms To


Import Statement


Swift

import AppKit

Objective-C

@import AppKit;

Availability


Available in OS X v10.7 and later.

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.

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

    Declaration

    Swift

    init!(key key: String!)

    Objective-C

    - (instancetype)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.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.7 and later.

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

    Declaration

    Objective-C

    + (NSDraggingImageComponent *)draggingImageComponentWithKey:(NSString *)key

    Parameters

    key

    The key.

    Return Value

    A dragging image component with the spiced key.

    Import Statement

    Objective-C

    @import AppKit;

    Availability

    Available in OS X v10.7 and later.

  • key key Property

    The unique name of this image component instance.

    Declaration

    Objective-C

    @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.

    Import Statement

    Objective-C

    @import AppKit;

    Availability

    Available in OS X v10.7 and later.

  • contents contents Property

    An object providing the image contents of the component.

    Declaration

    Swift

    var contents: AnyObject!

    Objective-C

    @property(strong) id contents

    Discussion

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

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.7 and later.

  • frame frame Property

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

    Declaration

    Swift

    var frame: NSRect

    Objective-C

    @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.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.7 and later.

    See Also

    draggingFrame (NSDraggingItem Class)

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

    Declaration

    Swift

    let NSDraggingImageComponentIconKey: String let NSDraggingImageComponentLabelKey: String

    Objective-C

    NSString * const NSDraggingImageComponentIconKey ; NSString * const NSDraggingImageComponentLabelKey;

    Constants

    • NSDraggingImageComponentIconKey

      NSDraggingImageComponentIconKey

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

      Available in OS X v10.7 and later.

    • NSDraggingImageComponentLabelKey

      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.