Sharath
Sharath

Reputation: 275

how to access tableviewcell using tableview instance

I am trying to change the particular tableview cell property through tableview instance.

In Objective c we can do that using the following code

id cell = [self tableView:tableView cellForRowAtIndexPath:indexPath];

The equivalent way of accessing in Xamarin seems impossible.

I know I can invoke reloaddata method on tableview instance and do the changes in getcell but I don't want to do like that I want to directly edit instead of triggering a reloaddata.

Upvotes: 1

Views: 550

Answers (1)

SushiHangover
SushiHangover

Reputation: 74144

You can obtain a UITableViewCell from a UITableView from "some" index via:

var cell = aTableViewInstance.CellAt(NSIndexPath.FromIndex(1));

Cast cell to your custom UITableViewCell type if needed to access any additional method/properties that you might have added.

CellAt(NSIndexPath) : UITableViewCell

Returns the table cell at the specified index path.

Upvotes: 4

Related Questions