See Also: UICollectionViewDelegate Members
Methods within MonoTouch.UIKit.UICollectionViewDelegate are called in reaction to events occurring within an associated MonoTouch.UIKit.UICollectionView. To use this class, you must derive from it and override its method to respond to events.
Although MonoTouch.UIKit.UICollectionView is a subtype of MonoTouch.UIKit.UIScrollView, MonoTouch.UIKit.UICollectionViewDelegate is not a subtype of MonoTouch.UIKit.UIScrollViewDelegate. Nonetheless, many of the methods in MonoTouch.UIKit.UICollectionViewDelegate mirror those of MonoTouch.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 MonoTouch.UIKit.UICollectionViewSource class provides an alternative to this class, combining the MonoTouch.UIKit.UICollectionViewDelegate API and the MonoTouch.UIKit.UICollectionViewDataSource APIs. It is available via the UICollectionView.Source property.
Selecting and highlighting in a MonoTouch.UIKit.UICollectionView follows this sequence:
User Action | UICollectionViewDelegate Methods | UICollectionViewCell 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 up | UICollectionViewDelegate.ShouldSelectItem is called. If it returns false, processing stops. | |
UICollectionViewDelegate.ItemSelected is called. UICollectionViewDelegate.ItemUnhighlighted is called. | Highlighted == false; Selected == true |
Deselecting a MonoTouch.UIKit.UICollectionViewCell follows a similar sequence:
User Action | UICollectionViewDelegate Methods | UICollectionViewCell Properties |
---|---|---|
Nothing touched while some MonoTouch.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 |