Advertisement
pu_clu

Untitled

Apr 20th, 2018
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. public class GestesUrgenceTableViewSource : MvxSimpleTableViewSource
  2. {
  3. private ItemGestesUrgenceDetailCell _offscreenCell;
  4. private bool _developTableView;
  5. private nfloat _tableViewHeight;
  6.  
  7. public GestesUrgenceTableViewSource(UITableView tableView, string nibName, string cellIdentifier = null, NSBundle bundle = null, bool developTableView = false)
  8. : base(tableView, nibName, cellIdentifier, bundle)
  9. {
  10. _developTableView = developTableView;
  11. }
  12.  
  13. public override nfloat GetHeightForRow(UITableView tableView, NSIndexPath indexPath)
  14. {
  15. if (this._offscreenCell == null)
  16. {
  17. this._offscreenCell = ItemGestesUrgenceDetailCell.Create();
  18. }
  19.  
  20. var cell = this._offscreenCell;
  21. cell.DataContext = this.GetItemAt(indexPath);
  22.  
  23. cell.SetNeedsUpdateConstraints();
  24. cell.UpdateConstraintsIfNeeded();
  25.  
  26. cell.Bounds = new CGRect(0f, 0f, this.TableView.Bounds.Width, this.TableView.Bounds.Height);
  27.  
  28. cell.SetNeedsLayout();
  29. cell.LayoutIfNeeded();
  30.  
  31. var height = cell.ContentView.SystemLayoutSizeFittingSize(UIView.UILayoutFittingCompressedSize).Height;
  32. height += 1;
  33.  
  34. if (_developTableView)
  35. {
  36. _tableViewHeight += height;
  37. tableView.Frame = new CGRect(0f, 0f, this.TableView.Bounds.Width, _tableViewHeight);
  38. }
  39.  
  40. return height;
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement