public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { FamilySearchResultCell cell = tableView.DequeueReusableCell(FamilySearchResultCell.Identifier) as FamilySearchResultCell; // if there are no cells to reuse, create a new one if (cell == null) { cell = new FamilySearchResultCell(UITableViewCellStyle.Default, FamilySearchResultCell.Identifier); // configure the cell colors cell.SelectionStyle = UITableViewCellSelectionStyle.None; } nfloat cellWidth = tableView.Bounds.Width * .98f; if (Parent.Families.Count > 0) { // is this an actual family row? (as opposed to our bottom dummy row) if (indexPath.Row < Parent.Families.Count) { cell.FamilyView.FormatCell(cellWidth, Parent.Families[indexPath.Row]); cell.Bounds = cell.FamilyView.Bounds; // if the row is beyond what we've stored, add it. if (indexPath.Row >= CellHeights.Count) { CellHeights.Add(cell.Bounds.Height); } else { // otherwise replace the existing entry CellHeights[indexPath.Row] = cell.Bounds.Height; } } else { // this is the bottom dummy cell, so just give it a little padding. cell.FamilyView.Container.Hidden = true; } } // either they've never searched, or it's a failed search else { if (Parent.DidSearchFail == true) { cell.FamilyView.FormatCell(cellWidth, Strings.Search_NoResults_Title, Strings.Search_NoResults_Suggestions, "", Strings.Search_NoResults_Suggestion1, Strings.Search_NoResults_Suggestion2); // if the row is beyond what we've stored, add it. if (indexPath.Row >= CellHeights.Count) { CellHeights.Add(cell.Bounds.Height); } else { // otherwise replace the existing entry CellHeights[indexPath.Row] = cell.Bounds.Height; } } else { cell.FamilyView.Container.Hidden = true; } } return(cell); }
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { FamilySearchResultCell cell = tableView.DequeueReusableCell( FamilySearchResultCell.Identifier ) as FamilySearchResultCell; // if there are no cells to reuse, create a new one if (cell == null) { cell = new FamilySearchResultCell( UITableViewCellStyle.Default, FamilySearchResultCell.Identifier ); // configure the cell colors cell.SelectionStyle = UITableViewCellSelectionStyle.None; } nfloat cellWidth = tableView.Bounds.Width * .98f; if ( Parent.Families.Count > 0 ) { // is this an actual family row? (as opposed to our bottom dummy row) if ( indexPath.Row < Parent.Families.Count ) { cell.FamilyView.FormatCell( cellWidth, Parent.Families[ indexPath.Row ] ); cell.Bounds = cell.FamilyView.Bounds; // if the row is beyond what we've stored, add it. if ( indexPath.Row >= CellHeights.Count ) { CellHeights.Add( cell.Bounds.Height ); } else { // otherwise replace the existing entry CellHeights[ indexPath.Row ] = cell.Bounds.Height; } } else { // this is the bottom dummy cell, so just give it a little padding. cell.FamilyView.Container.Hidden = true; } } // either they've never searched, or it's a failed search else { if ( Parent.DidSearchFail == true ) { cell.FamilyView.FormatCell( cellWidth, Strings.Search_NoResults_Title, Strings.Search_NoResults_Suggestions, "", Strings.Search_NoResults_Suggestion1, Strings.Search_NoResults_Suggestion2 ); // if the row is beyond what we've stored, add it. if ( indexPath.Row >= CellHeights.Count ) { CellHeights.Add( cell.Bounds.Height ); } else { // otherwise replace the existing entry CellHeights[ indexPath.Row ] = cell.Bounds.Height; } } else { cell.FamilyView.Container.Hidden = true; } } return cell; }