TableView does not call GetHeightForRow

2019-08-07 04:55发布

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?

2条回答
迷人小祖宗
2楼-- · 2019-08-07 05:35

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

        TableView.Source = new ItemsSource ();
查看更多
贪生不怕死
3楼-- · 2019-08-07 05:52

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.

查看更多
登录 后发表回答