共用方式為


UITableViewDelegate.GetHeightForRow(UITableView, NSIndexPath) 方法

定義

呼叫 以判斷位於 indexPath 的資料列高度。

[Foundation.Export("tableView:heightForRowAtIndexPath:")]
public virtual nfloat GetHeightForRow (UIKit.UITableView tableView, Foundation.NSIndexPath indexPath);
abstract member GetHeightForRow : UIKit.UITableView * Foundation.NSIndexPath -> nfloat
override this.GetHeightForRow : UIKit.UITableView * Foundation.NSIndexPath -> nfloat

參數

tableView
UITableView

資料表檢視。

indexPath
NSIndexPath

資料列的位置。

傳回

資料列的高度 (以點為單位,) 為 float

屬性

備註

這個方法可讓資料列具有不同的高度 (例如,包含可變數目的文字行) 。 如果實作這個方法,它會覆寫 RowHeight 資料表檢視上設定的屬性,其位於 的資料列 indexPath

使用這個方法,而不是 RowHeight 有效能影響:每次顯示資料表檢視時,都會針對每個資料列呼叫這個方法。 當資料表有大量的資料列 (例如,1000 個數據列或更多個) 資料列時,這可能會導致效能不佳。

適用於