iOS Guides | Samples

MonoTouch.UIKit.UICollectionViewDelegate Class

Used to receive notices relating to a UICollectionView.

See Also: UICollectionViewDelegate

Syntax

[MonoTouch.Foundation.Model]
[MonoTouch.Foundation.Protocol]
[MonoTouch.Foundation.Register("UICollectionViewDelegate", false)]
[MonoTouch.ObjCRuntime.Introduced(MonoTouch.ObjCRuntime.PlatformName.iOS, 6, 0, MonoTouch.ObjCRuntime.PlatformArchitecture.None, null)]
public class UICollectionViewDelegate : NSObject, IUICollectionViewDelegate, IDisposable

See Also

Remarks

Methods within UICollectionViewDelegate are called in reaction to events occurring within an associated UICollectionView. To use this class, you must derive from it and override its method to respond to events.

Although UICollectionView is a subtype of UIScrollView, UICollectionViewDelegate is not a subtype of UIScrollViewDelegate. Nonetheless, many of the methods in UICollectionViewDelegate mirror those of UIScrollViewDelegate and application developers may find it useful to consult the documentation of that class for a more detailed discussion of methods relating to scrolling.

The UICollectionViewSource class provides an alternative to this class, combining the UICollectionViewDelegate API and the UICollectionViewDataSource APIs. It is available via the UICollectionView.Source property.

Selecting and Highlighting

Selecting and highlighting in a UICollectionView follows this sequence:

User ActionUICollectionViewDelegate MethodsUICollectionViewCell Properties
Nothing touched

Highlighted == false; Selected == false

Finger down in cell

UICollectionViewDelegate.ShouldHighlightItem is called. If it returns false, processing stops.

UICollectionViewDelegate.ItemHighlighted is called.

Highlighted == true; Selected == false

Finger upUICollectionViewDelegate.ShouldSelectItem is called. If it returns false, processing stops.
UICollectionViewDelegate.ItemSelected is called. UICollectionViewDelegate.ItemUnhighlighted is called.

Highlighted == false; Selected == true

Deselecting a UICollectionViewCell follows a similar sequence:

User ActionUICollectionViewDelegate MethodsUICollectionViewCell Properties
Nothing touched while some UICollectionViewCell is highlighted.

Highlighted == false; Selected == true

Finger taps cell (Deselect gesture)UICollectionViewDelegate.ShouldDeselectItem is called. If it returns false, processing stops.
UICollectionViewDelegate.ItemDeselected is called.

Highlighted == false; Selected == false

Related content

Requirements

Namespace: MonoTouch.UIKit
Assembly: monotouch (in monotouch.dll)
Assembly Versions: 0.0.0.0

The members of MonoTouch.UIKit.UICollectionViewDelegate are listed below.

See Also: NSObject

Public Constructors

Default constructor, initializes a new instance of this class.
A constructor that initializes the object from the data stored in the unarchiver object.
Constructor to call on derived classes to skip initialization and merely allocate the object.
A constructor used when creating managed representations of unmanaged objects; Called by the runtime.

Public Methods

CanFocusItem(UICollectionView, NSIndexPath) : Boolean
Whether the item at indexPath can be focused.
CanPerformAction(UICollectionView, Selector, NSIndexPath, NSObject) : Boolean
Whether this UICollectionViewDelegate can perform the specified action on an item in the UICollectionView.
CellDisplayingEnded(UICollectionView, UICollectionViewCell, NSIndexPath)
Indicates that the specified cell was removed from the UICollectionView.
DecelerationEnded(UIScrollView)
Indicates that deceleration from a scrolling event has completed.
DecelerationStarted(UIScrollView)
Indicates that deceleration from a scrolling event has begun.
DidUpdateFocus(UICollectionView, UICollectionViewFocusUpdateContext, UIFocusAnimationCoordinator)
Delegate method called shortly after focus has changed to a new UIView.
DidZoom(UIScrollView)
Indicates that zooming has occurred.
DraggingEnded(UIScrollView, Boolean)
Indicates that dragging has completed.
DraggingStarted(UIScrollView)
Indicates that dragging has begun.
GetIndexPathForPreferredFocusedView(UICollectionView) : NSIndexPath
When overridden, allows the developer to specify the item that should initially receive focus.
GetTargetContentOffset(UICollectionView, PointF) : PointF
When overridden, allows the developer to modify the content offset for layout and animation changes.
GetTargetIndexPathForMove(UICollectionView, NSIndexPath, NSIndexPath) : NSIndexPath
When overridden, allows the developer to modify the final location of a moved item. (For instance, to disallow a move to a particular proposedIndexPath.)
ItemDeselected(UICollectionView, NSIndexPath)
Indicates that the item at the specified index was deselected.
ItemHighlighted(UICollectionView, NSIndexPath)
Indicates that the specified item was highlighted.
ItemSelected(UICollectionView, NSIndexPath)
Indicates that the item at the specified index was selected.
ItemUnhighlighted(UICollectionView, NSIndexPath)
Indicates that the item at the specified index had its highlight removed.
PerformAction(UICollectionView, Selector, NSIndexPath, NSObject)
Performs the specified action on an item in the UICollectionView.
ScrollAnimationEnded(UIScrollView)
Indicates that animation relating to a scrolling event has completed.
Scrolled(UIScrollView)
Indicates that scrolling occurred.
ScrolledToTop(UIScrollView)
Indicates that the UICollectionView has scrolled to its beginning.
ShouldDeselectItem(UICollectionView, NSIndexPath) : Boolean
Whether the specified item should be deselected.
ShouldHighlightItem(UICollectionView, NSIndexPath) : Boolean
Whether the specified item should be highlighted during tracking.
ShouldScrollToTop(UIScrollView) : Boolean
Whether the UICollectionView should scroll to its beginning.
ShouldSelectItem(UICollectionView, NSIndexPath) : Boolean
Whether the specified item should be selected.
ShouldShowMenu(UICollectionView, NSIndexPath) : Boolean
Whether an action menu should be displayed for the specified item.
ShouldUpdateFocus(UICollectionView, UICollectionViewFocusUpdateContext) : Boolean
Called prior to a cell in the collectionView either losing or receiving focus. If either focus environment returns false, the focus update is canceled.
SupplementaryViewDisplayingEnded(UICollectionView, UICollectionReusableView, NSString, NSIndexPath)
Indicates that the specified supplementary view was removed from the UICollectionView.
TransitionLayout(UICollectionView, UICollectionViewLayout, UICollectionViewLayout) : UICollectionViewTransitionLayout
A custom transition layout for use when moving between selected layouts.
ViewForZoomingInScrollView(UIScrollView) : UIView
The UIView to use when zooming is about to occur.
WillDisplayCell(UICollectionView, UICollectionViewCell, NSIndexPath)
The cell is about to be displayed.
WillDisplaySupplementaryView(UICollectionView, UICollectionReusableView, String, NSIndexPath)
The supplementary view is about to be displayed.
WillEndDragging(UIScrollView, PointF, ref PointF)
Indicates that dragging is about to complete.
ZoomingEnded(UIScrollView, UIView, Single)
Indicates that zooming has completed.
ZoomingStarted(UIScrollView, UIView)
Indicates that zooming has begun.