| Inherits from | |
| Conforms to | |
| Framework | /System/Library/Frameworks/AppKit.framework |
| Availability | Available in Mac OS X v10.5 and later. |
| Declared in | NSCollectionView.h |
NSCollectionView displays an array of content as a grid of views.
– setSelectable:
– isSelectable
– setAllowsMultipleSelection:
– allowsMultipleSelection
– setSelectionIndexes:
– selectionIndexes
– setMaxNumberOfRows:
– maxNumberOfRows
– setMaxNumberOfColumns:
– maxNumberOfColumns
– setMinItemSize:
– minItemSize
– setMaxItemSize:
– maxItemSize
Returns a Boolean value that indicates whether the receiver allows the user to select more than one item at a time.
- (BOOL)allowsMultipleSelection
YES if the receiver allows the user to select more than one column or row at a time, otherwise NO.
NSCollectionView.hReturn the receiver’s background colors.
- (NSArray *)backgroundColors
Returns an array containing the receiver’s background colors.
NSCollectionView.hReturns the receiver’s content object.
- (NSArray *)content
An array containing the receiver’s content.
This property is observable using key-value observing.
NSCollectionView.hReturns whether the receiver is the first responder.
- (BOOL)isFirstResponder
YES if the receiver is the first responder, otherwise NO.
This method is fully key-value observing compliant.
NSCollectionView.hReturns a Boolean value that indicates whether the receiver allows the user to select items, NO if it doesn’t.
- (BOOL)isSelectable
YES if the receiver allows the user to select items, otherwise NO.
NSCollectionView.hReturns the receiver’s collection view item prototype.
- (NSCollectionViewItem *)itemPrototype
The receiver’s collection view item prototype.
NSCollectionView.hReturns the maximum size used to display individual collection view items in the grid
- (NSSize)maxItemSize
The maximum size, measured in points, used to display individual collection view items.
NSCollectionView.hReturns the maximum number of columns the receiver will display.
- (NSUInteger)maxNumberOfColumns
The maximum number of columns the receiver will display.
NSCollectionView.hReturns the maximum number of rows the receiver will display.
- (NSUInteger)maxNumberOfRows
The maximum number of rows the receiver will display.
NSCollectionView.hReturns the minimum size used to display individual collection view items in the grid.
- (NSSize)minItemSize
The minimum size, measured in points, used to display individual collection view items.
NSCollectionView.hReturns the collection view item that is used for the specified object.
- (NSCollectionViewItem *)newItemForRepresentedObject:(id)object
The content object that the collection view item will represent.
An initialized collection view item with the specified object and the appropriate view set. The collection view item should not be autoreleased.
Subclasses can override this method if the collection view items are not generated from a prototype or if the prototype view needs to be modified. The subclass is responsible for setting the view and representedObject of the new collection view item.
NSCollectionView.hReturns an index set containing the indexes of the receiver’s currently selected objects in the content array.
- (NSIndexSet *)selectionIndexes
An index set containing the indexes of the receiver’s currently selected objects in the content array.
This property is observable using key-value observing.
NSCollectionView.hControls whether the user can select multiple items at a time.
- (void)setAllowsMultipleSelection:(BOOL)flag
YES to allow the user to select multiple items, otherwise NO.
NSCollectionView.hSets the receiver's background colors to the specified array of colors.
- (void)setBackgroundColors:(NSArray *)colors
An array containing the background colors for the receiver.
Passing an empty array or nil resets the background colors to their default values provided by controlAlternatingRowBackgroundColors.
NSCollectionView.hSets the receiver’s content array.
- (void)setContent:(NSArray *)content
An array containing the receiver’s content.
The content array can also be provided by creating a binding between the receiver’s NSContentBinding and an array controller’s arrangedObjects method.
NSCollectionView.hSets the reciever’s item prototype to the specified collection view item.
- (void)setItemPrototype:(NSCollectionViewItem *)prototype
The collection view item used as the prototype by the receiver.
NSCollectionView.hSets the maximum size used to display individual collection view items in the grid.
- (void)setMaxItemSize:(NSSize)size
The new maximum size, measured in points, with which to display individual collection view items.
Setting the size to (0,0) specifies no maximum grid size. The default is (0.0). If the view in the receiver’s collection view item prototype is resizable you should set this to the maximum size that the view should be displayed using.
NSCollectionView.hSets the maximum number of columns the receiver will display
- (void)setMaxNumberOfColumns:(NSUInteger)number
The maximum number of columns the receiver will display.
Setting to 0 specifies no maximum number of columns. Defaults to 0.
It is possible for a NSCollectionView instance to specify both the maximum number of rows and a maximum number of columns. If the number of content objects exceeds the number of displayable items (n=maxNumberOfRows * maxNumberOfColumns) only the first n items of the content array are displayed.
NSCollectionView.hSets the maximum number of rows the receiver will display.
- (void)setMaxNumberOfRows:(NSUInteger)number
The maximum number of rows the receiver can display.
Setting to 0 specifies no maximum number of rows. Defaults to 0.
It is possible for a NSCollectionView instance to specify both the maximum number of rows and a maximum number of columns. If the number of content objects exceeds the number of displayable items (n=maxNumberOfRows * maxNumberOfColumns) only the first n items of the content array are displayed.
NSCollectionView.hSets the minimum size used to display individual layout items in the grid.
- (void)setMinItemSize:(NSSize)size
The new minimum size, measured in points, with which to display individual layout items.
The default is (0.0). If the view in the receiver’s collection view item prototype is resizable you should set this to the minimum size that the view should be displayed using.
NSCollectionView.hControls whether the receiver allows the user to select items.
- (void)setSelectable:(BOOL)flag
If flag is YES, the receiver allows the user to select items; if flag is NO, it doesn’t.
You can set selections programmatically regardless of this setting.
NSCollectionView.hSets the receiver’s selection using the specified indexes.
- (void)setSelectionIndexes:(NSIndexSet *)indexes
The set of selection indexes for the receiver.
To select all the receiver’s objects, indexes should be an index set with indexes [0...count -1]. To deselect all indexes, pass an empty index set.
NSCollectionView.h
© 2007 Apple Inc. All Rights Reserved. (Last updated: 2007-12-11)