Mac Developer Library

Developer

AppKit Framework Reference NSCollectionViewItem Class Reference

Options
Deployment Target:

On This Page
Language:

NSCollectionViewItem

Inheritance


Conforms To


Import Statement


Swift

import AppKit

Objective-C

@import AppKit;

Availability


Available in OS X v10.5 and later.

The NSCollectionViewItem class is a view controller subclass that manages the relationship between a compound view and the model object that provides its content.

New instances of NSCollectionViewItem are created using the NSCollectionView method newItemForRepresentedObject:. See NSCollectionView Class Reference for details.

  • imageView imageView Property

    An image view to display an image in the collection item.

    Declaration

    Swift

    @IBOutlet unowned(unsafe) var imageView: NSImageView!

    Objective-C

    @property(assign) IBOutlet NSImageView *imageView

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.7 and later.

    See Also

    textField

  • textField textField Property

    A text field to display a string in the collection item.

    Declaration

    Swift

    @IBOutlet unowned(unsafe) var textField: NSTextField!

    Objective-C

    @property(assign) IBOutlet NSTextField *textField

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.7 and later.

    See Also

    imageView

  • selected selected Property

    Specifies if the collection item is selected.

    Declaration

    Swift

    var selected: Bool

    Objective-C

    @property(getter=isSelected) BOOL selected

    Discussion

    YEStrue if the receiver is selected, otherwise NOfalse.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.7 and later.

  • Returns the receiver’s collection view. (read-only)

    Declaration

    Swift

    var collectionView: NSCollectionView! { get }

    Objective-C

    @property(readonly) NSCollectionView *collectionView

    Discussion

    This method return’s the receiver’s collection view.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.5 and later.

  • Dragging images for multi-image drag and drop support. (read-only)

    Declaration

    Swift

    var draggingImageComponents: [AnyObject] { get }

    Objective-C

    @property(readonly) NSArray *draggingImageComponents

    Discussion

    The component frames are relative to a coordinate system that has its origin at the bottom left, so you need to take into account the flipped state of your view when computing the component frames.

    This methods can be subclassed and overridden to provide a custom set of NSDraggingImageComponent objects to create the drag image.

    The default implementation will return an array of up to two NSDraggingImageComponent instances -- one for the imageView and another for the textField (if not nil).

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.7 and later.

  • setRepresentedObject: - setRepresentedObject: Available in OS X v10.5 through OS X v10.5

    Sets the receiver’s represented object to the specified model object.

    Deprecation Statement

    This method is deprecated and replaced by newItemForRepresentedObject: in the NSViewController superclass.

    Declaration

    Objective-C

    - (void)setRepresentedObject:(id)object

    Parameters

    object

    The receiver’s model object.

    Import Statement

    Objective-C

    @import AppKit;

    Availability

    Available in OS X v10.5 through OS X v10.5.

  • representedObject - representedObject Available in OS X v10.5 through OS X v10.5

    Returns the receiver’s represented object.

    Deprecation Statement

    This method is deprecated. See the NSViewController superclass.

    Declaration

    Objective-C

    - (id)representedObject

    Return Value

    The receiver’s represented object.

    Import Statement

    Objective-C

    @import AppKit;

    Availability

    Available in OS X v10.5 through OS X v10.5.

  • setView: - setView: Available in OS X v10.5 through OS X v10.5

    Sets the view the receiver uses to display its represented object.

    Deprecation Statement

    This method is deprecated and replaced by setView:, in the NSViewController superclass.

    Declaration

    Objective-C

    - (void)setView:(NSView *)view

    Parameters

    view

    The view that is used to display the receiver’s represented object.

    Import Statement

    Objective-C

    @import AppKit;

    Availability

    Available in OS X v10.5 through OS X v10.5.

  • view - view Available in OS X v10.5 through OS X v10.5

    Returns the view the receiver uses to display its represented object.

    Deprecation Statement

    This method is deprecated and replaced by view, in the NSViewController superclass.

    Declaration

    Objective-C

    - (NSView *)view

    Return Value

    The view the receiver uses to display its represented object.

    Import Statement

    Objective-C

    @import AppKit;

    Availability

    Available in OS X v10.5 through OS X v10.5.