Platforms to show: All Mac Windows Linux Cross-Platform

NSCollectionViewItemMBS class

Super class: NSViewControllerMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
class Cocoa Collection View MBS MacControls Plugin 21.0 ✅ Yes ❌ No ❌ No ❌ No Desktop only
The visual representation for a single data element in a collection view.

Item objects are view controllers, and you use their view hierarchies to display your content. The default implementation of this class supports the creation of a simple item that displays a single image or string. If the appearance or layout of your items is more sophisticated, you can subclass and configure the view hierarchy based on your needs.

see also
https://developer.apple.com/documentation/appkit/nscollectionviewitem
Subclass of the NSViewControllerMBS class.

Highlight States

Constant Value Description
HighlightAsDropTarget 3 The drop target highlight state. This type of highlight is applied when the item is the target of a drop operation on the collection view. After the drop operation completes, the highlight state returns to HighlightNone.
HighlightForDeselection 2 The deselection highlight state. During interactive selection, this state is used to indicate that the item will become deselected when interactions end. After interactions end, the highlight state returns to HighlightNone.
HighlightForSelection 1 The selected highlight state. This type of highlight is applied when an item is selected. During interactive highlighting, this state is also applied to indicate that the item will become highlighted.
HighlightNone 0 No highlight state.

Super class NSViewControllerMBS

Edge Constants

Constant Value Description
NSMaxXEdge 2 the maximum X edge. Typically right side.
NSMaxYEdge 3 The maximum Y edge. Topically the top edge of a window.
NSMinXEdge 0 the minimum X edge. Typically left side.
NSMinYEdge 1 Minimum Y. As coordinates are upside down in the Cocoa world, this is the bottom edge of a window.

Behavior modes

Constant Value Description
PopoverBehaviorApplicationDefined 0 Your application assumes responsibility for closing the popover. AppKit will still close the popover in a limited number of circumstances. For instance, AppKit will attempt to close the popover when the window of its positioningView is closed. The exact interactions in which AppKit will close the popover are not guaranteed. You may consider implementing -cancel: to close the popover when the escape key is pressed.
PopoverBehaviorSemitransient 2 AppKit will close the popover when the user interacts with user interface elements in the window containing the popover's positioning view. Semi-transient popovers cannot be shown relative to views in other popovers, nor can they be shown relative to views in child windows. The exact interactions that cause semi-transient popovers to close are not specified.
PopoverBehaviorTransient 1 AppKit will close the popover when the user interacts with a user interface element outside the popover. Note that interacting with menus or panels that become key only when needed will not cause a transient popover to close. The exact interactions that will cause transient popovers to close are not specified.

Super class NSResponderMBS

This class has no sub classes.

Some methods using this class:

Some events using this class:

Some examples using this class:


The items on this page are in the following plugins: MBS MacBase Plugin, MBS MacControls Plugin.


NSCollectionViewGridLayoutMBS   -   NSCollectionViewLayoutAttributesMBS


The biggest plugin in space...