UIKit.UICollectionViewDelegate Class
Used to receive notices relating to a UIKit.UICollectionView.

See Also: UICollectionViewDelegate Members

Syntax

[Foundation.Model]
[Foundation.Protocol]
[Foundation.Register("UICollectionViewDelegate", false)]
[ObjCRuntime.Availability(Introduced=ObjCRuntime.Platform.iOS_6_0)]
public class UICollectionViewDelegate : Foundation.NSObject, IUICollectionViewDelegate, IDisposable

See Also

UICollectionViewSource

Remarks

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

Although UIKit.UICollectionView is a subtype of UIKit.UIScrollView, UIKit.UICollectionViewDelegate is not a subtype of UIKit.UIScrollViewDelegate. Nonetheless, many of the methods in UIKit.UICollectionViewDelegate mirror those of UIKit.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 UIKit.UICollectionViewSource class provides an alternative to this class, combining the UIKit.UICollectionViewDelegate API and the UIKit.UICollectionViewDataSource APIs. It is available via the UICollectionView.Source property.

Selecting and Highlighting

Selecting and highlighting in a UIKit.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 UIKit.UICollectionViewCell follows a similar sequence:

User ActionUICollectionViewDelegate MethodsUICollectionViewCell Properties
Nothing touched while some UIKit.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: UIKit
Assembly: Xamarin.iOS (in Xamarin.iOS.dll)
Assembly Versions: 0.0.0.0