NSCollectionViewItem Class Reference

Inherits from
Conforms to
NSCopying
NSCoding (NSViewController)
NSCoding (NSResponder)
NSObject (NSObject)
NSEditor (Informal Protocol) (NSViewController)
NSEditorRegistration (Informal Protocol) (NSViewController)
Framework
/System/Library/Frameworks/AppKit.framework
Availability
Available in Mac OS X v10.5 and later.
Declared in
NSCollectionView.h

Overview

NSCollectionViewItem class is a controller that manages the relationship between a compound view and the model object that provides its content. Instances of this class are replicated in a NSCollectionView.

Important: In Mac OS X v10.5, the superclass of the NSCollectionViewItem class was NSObject. In Mac OS X v10.6 and later, NSCollectionViewItem is now a subclass of NSViewController. This change was made to improve how the view is replicated within the NSCollectionView. NSCollectionViewItem remains binary compatible with the previous implementation and unarchiving is correctly handled.

Tasks

Setting the Represented Object

Modifying the View

Managing the Selection

Parent Collection View

Instance Methods

collectionView

Returns the receiver’s collection view.

- (NSCollectionView *)collectionView

Return Value

The receiver’s collection view.

Availability
  • Available in Mac OS X v10.5 and later.
Declared In
NSCollectionView.h

isSelected

Returns the selection state of the receiver.

- (BOOL)isSelected

Return Value

YES if the receiver is selected, otherwise NO.

Availability
  • Available in Mac OS X v10.5 and later.
Declared In
NSCollectionView.h

representedObject

Returns the receiver’s represented object.

- (id)representedObject

Return Value

The receiver’s represented object.

Availability
  • Available in Mac OS X v10.5 through Mac OS X v10.5.
Declared In
NSCollectionView.h

setRepresentedObject:

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

- (void)setRepresentedObject:(id)object

Parameters
object

The receiver’s model object.

Availability
  • Available in Mac OS X v10.5 through Mac OS X v10.5.
Declared In
NSCollectionView.h

setSelected:

Sets the selection state of the receiver.

- (void)setSelected:(BOOL)flag

Parameters
flag

YES if the receiver is selected, otherwise NO.

Availability
  • Available in Mac OS X v10.5 and later.
Declared In
NSCollectionView.h

setView:

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

- (void)setView:(NSView *)view

Parameters
view

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

Availability
  • Available in Mac OS X v10.5 through Mac OS X v10.5.
Declared In
NSCollectionView.h

view

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

- (NSView *)view

Return Value

The view the receiver uses to display its represented object.

Availability
  • Available in Mac OS X v10.5 through Mac OS X v10.5.
Declared In
NSCollectionView.h


© 2009 Apple Inc. All Rights Reserved. (Last updated: 2009-05-01)