如何使用tableview实例访问tableviewcell
how to access tableviewcell using tableview instance
我正在尝试通过 tableview 实例更改特定的 tableview 单元格 属性。
在Objective c中我们可以使用下面的代码
id cell = [self tableView:tableView cellForRowAtIndexPath:indexPath];
Xamarin 中的等效访问方式似乎是不可能的。
我知道我可以在 tableview 实例上调用 reloaddata 方法并在 getcell 中进行更改,但我不想那样做我想直接编辑而不是触发 reloaddata。
您可以通过以下方式从“某些”索引的 UITableView
中获取 UITableViewCell
:
var cell = aTableViewInstance.CellAt(NSIndexPath.FromIndex(1));
如果需要,将 cell
转换为您的自定义 UITableViewCell
类型,以访问您可能已添加的任何其他 method/properties。
CellAt(NSIndexPath) : UITableViewCell
Returns the table cell at the specified index path.
我正在尝试通过 tableview 实例更改特定的 tableview 单元格 属性。
在Objective c中我们可以使用下面的代码
id cell = [self tableView:tableView cellForRowAtIndexPath:indexPath];
Xamarin 中的等效访问方式似乎是不可能的。
我知道我可以在 tableview 实例上调用 reloaddata 方法并在 getcell 中进行更改,但我不想那样做我想直接编辑而不是触发 reloaddata。
您可以通过以下方式从“某些”索引的 UITableView
中获取 UITableViewCell
:
var cell = aTableViewInstance.CellAt(NSIndexPath.FromIndex(1));
如果需要,将 cell
转换为您的自定义 UITableViewCell
类型,以访问您可能已添加的任何其他 method/properties。
CellAt(NSIndexPath) : UITableViewCell
Returns the table cell at the specified index path.