共用方式為


UITableView.SelectRow(NSIndexPath, Boolean, UITableViewScrollPosition) 方法

定義

選取指定的資料列,選擇性地將資料列捲動至特定位置。

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

參數

indexPath
NSIndexPath

識別要選取的資料列。

這個參數可以是 null

animated
Boolean

true 表示如果應該立即發生變更, false 則為選取範圍和位置變更產生動畫效果。

scrollPosition
UITableViewScrollPosition

選取的資料列應該捲動至 (頂端、中間、底部) 的位置。

屬性

範例

None傳遞 。 即使常數通常造成最小捲動) ,仍不會產生任何捲動 (。 若要以最小捲動方式捲動至新選取的資料列,請使用此方法選取資料列, None 然後使用 ScrollToRow(NSIndexPath, UITableViewScrollPosition, Boolean) 呼叫 。 None

NSIndexPath rowToSelect; // assume this is valid
UITableView myTableView; // assume this is valid

myTableView.SelectRow (rowToSelect, true, UITableViewScrollPosition.None);
myTableView.ScrollToRow (rowToSelect, UITableViewScrollPosition.None, true);

備註

呼叫此方法不會觸發 WillSelectRow(UITableView, NSIndexPath) ,也不會傳送 SelectionDidChangeNotification 通知。

適用於