特定のユーザーのデータがあるかどうかに基づいてセルを非表示にしたいとします。私の現在のアプローチはエラーthe requested operation resulted in a stack overflow
を引き起こします。(Xamarinの)UITableViewでのセルの非表示
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
{
...
cell.TextLabel.Text = items.Keys.ElementAt(indexPath.Row);
cell.DetailTextLabel.Text = items[items.Keys.ElementAt(indexPath.Row)];
if (string.IsNullOrEmpty(cell.DetailTextLabel.Text)){
cell.Hidden = true;
cell.Tag = 3;
}
return cell;
}
public override nfloat GetHeightForRow(UITableView tableView, NSIndexPath indexPath)
{
UITableViewCell cell = tableView.CellAt(indexPath); //ERROR HERE
if (cell.Tag == 3)
{
return 0;
}
return base.GetHeightForRow(tableView, indexPath);
}
このエラーを回避し、正しく行を非表示にするにはどうすればよいですか?
ありがとうございます!私は脳のおならの瞬間をそこに持っていた(このイオスプロジェクトから1週間離れていた)、テーブルに典型的に関わるデータ構造の操作を忘れてしまった。 – panthor314