Edit

Share via


UICollectionView.SelectItem Method

Definition

Selects a UICollectionViewCell and optionally scrolls to make it visible.

[Foundation.Export("selectItemAtIndexPath:animated:scrollPosition:")]
public virtual void SelectItem (Foundation.NSIndexPath indexPath, bool animated, UIKit.UICollectionViewScrollPosition scrollPosition);
abstract member SelectItem : Foundation.NSIndexPath * bool * UIKit.UICollectionViewScrollPosition -> unit
override this.SelectItem : Foundation.NSIndexPath * bool * UIKit.UICollectionViewScrollPosition -> unit

Parameters

indexPath
NSIndexPath

The NSIndexPath of the desired element.

animated
Boolean

true if the selection change should be animated.

scrollPosition
UICollectionViewScrollPosition

Where the item should be positioned after scrolling finishes.

Attributes

Remarks

This method does nothing if AllowsSelection is false. This method deselects the currently selected element if AllowsMultipleSelection is false.

This method does not trigger calls to any selection-related delegate methods (e.g., ItemSelected(UICollectionView, NSIndexPath) or ItemDeselected(UICollectionView, NSIndexPath)).

Applies to