public override float GetHeightForRow(MonoTouch.UIKit.UITableView tableView, MonoTouch.Foundation.NSIndexPath indexPath)
        {
            if (_usedForHeight == null)
            {
                _usedForHeight = (PullRequestCellView)tableView.DequeueReusableCell(PullRequestCellView.Key);
            }

            var item = ItemAt(indexPath) as PullRequestItemViewModel;

            if (item != null)
            {
                _usedForHeight.ViewModel = item;
                _usedForHeight.SetNeedsUpdateConstraints();
                _usedForHeight.UpdateConstraintsIfNeeded();
                _usedForHeight.Bounds = new System.Drawing.RectangleF(0, 0, tableView.Bounds.Width, tableView.Bounds.Height);
                _usedForHeight.SetNeedsLayout();
                _usedForHeight.LayoutIfNeeded();
                return(_usedForHeight.ContentView.SystemLayoutSizeFittingSize(MonoTouch.UIKit.UIView.UILayoutFittingCompressedSize).Height + 1);
            }

            return(base.GetHeightForRow(tableView, indexPath));
        }
Example #2
0
        public override UITableViewCell GetCell(UITableView tv)
        {
            var c = tv.DequeueReusableCell(PullRequestCellView.Key) as PullRequestCellView ?? PullRequestCellView.Create();

            c.Bind(_model.Title, _model.CreatedOn.Humanize(), _avatar);
            return(c);
        }
Example #3
0
        public override UITableViewCell GetCell(UITableView tv)
        {
            var c = tv.DequeueReusableCell(PullRequestCellView.Key) as PullRequestCellView ?? PullRequestCellView.Create();

            c.Set(_model.Title, _model.CreatedAt, new GitHubAvatar(_model.User?.AvatarUrl));
            return(c);
        }
Example #4
0
 public PullRequestTableViewSource(UITableView tableView, IReactiveNotifyCollectionChanged <PullRequestItemViewModel> collection)
     : base(tableView, collection, PullRequestCellView.Key, 60.0f)
 {
     _cache = new TableViewCellHeightCache <PullRequestCellView, PullRequestItemViewModel>(60f, () => PullRequestCellView.Create(true));
     tableView.RegisterNibForCellReuse(PullRequestCellView.Nib, PullRequestCellView.Key);
 }