Jonas Sourlier
Jonas Sourlier

Reputation: 14435

TableView does not call GetHeightForRow

I have a class which inherits from UITableViewSource and overrides GetHeightForRow:

public override float GetHeightForRow(UITableView tableView, NSIndexPath indexPath)

However, at some point in time the OS stopped calling this method, so all my cells have the same height now. The rest of the table and table source is working fine. This is very strange, and I have tried all sorts of things, but it just does not call the method. The other overridden methods of the table source are called normally.

Is there some sort of a setting which makes the UITableView stop calling GetHeightForRow?

Upvotes: 1

Views: 1568

Answers (2)

user3124624
user3124624

Reputation: 1216

Add the below line in ViewWillAppear method. This works out.

        TableView.Source = new ItemsSource ();

Upvotes: 0

poupou
poupou

Reputation: 43553

Could you be setting both a Delegate (or WeakDelegate) of type UITableViewDelegate and the Source (of type UITableViewSource) property ?

They both expose GetHeightForRow and they will conflict if both are used on the same UITableView.

Upvotes: 4

Related Questions