Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class GestesUrgenceTableViewSource : MvxSimpleTableViewSource
- {
- private ItemGestesUrgenceDetailCell _offscreenCell;
- private bool _developTableView;
- private nfloat _tableViewHeight;
- public GestesUrgenceTableViewSource(UITableView tableView, string nibName, string cellIdentifier = null, NSBundle bundle = null, bool developTableView = false)
- : base(tableView, nibName, cellIdentifier, bundle)
- {
- _developTableView = developTableView;
- }
- public override nfloat GetHeightForRow(UITableView tableView, NSIndexPath indexPath)
- {
- if (this._offscreenCell == null)
- {
- this._offscreenCell = ItemGestesUrgenceDetailCell.Create();
- }
- var cell = this._offscreenCell;
- cell.DataContext = this.GetItemAt(indexPath);
- cell.SetNeedsUpdateConstraints();
- cell.UpdateConstraintsIfNeeded();
- cell.Bounds = new CGRect(0f, 0f, this.TableView.Bounds.Width, this.TableView.Bounds.Height);
- cell.SetNeedsLayout();
- cell.LayoutIfNeeded();
- var height = cell.ContentView.SystemLayoutSizeFittingSize(UIView.UILayoutFittingCompressedSize).Height;
- height += 1;
- if (_developTableView)
- {
- _tableViewHeight += height;
- tableView.Frame = new CGRect(0f, 0f, this.TableView.Bounds.Width, _tableViewHeight);
- }
- return height;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement