Пример #1
0
        public override float GetHeightForRow(MonoTouch.UIKit.UITableView tableView, MonoTouch.Foundation.NSIndexPath indexPath)
        {
            if (_usedForHeight == null)
            {
                _usedForHeight = (NewsCellView)tableView.DequeueReusableCell(NewsCellView.Key);
            }

            var item = ItemAt(indexPath) as EventItemViewModel;

            if (item != null)
            {
                var s = 6f + NewsCellView.TimeFont.LineHeight + 5f + (NewsCellView.HeaderFont.LineHeight * 2) + 4f + 7f;
                _usedForHeight.ViewModel = item;

                if (_usedForHeight.BodyString.Length == 0)
                {
                    return(s);
                }

                var rec    = _usedForHeight.BodyString.GetBoundingRect(new SizeF(tableView.Bounds.Width - 56, 10000), NSStringDrawingOptions.UsesLineFragmentOrigin | NSStringDrawingOptions.UsesFontLeading, null);
                var height = rec.Height;

                if (item.BodyBlocks.Count == 1 && height > (CharacterHeight * 4))
                {
                    height = CharacterHeight * 4;
                }

                var descCalc = s + height;
                var ret      = ((int)Math.Ceiling(descCalc)) + 1f + 8f;
                return(ret);
            }

            return(base.GetHeightForRow(tableView, indexPath));
        }
Пример #2
0
    public override MonoTouch.UIKit.UITableViewCell GetCell(MonoTouch.UIKit.UITableView tv)
    {
        MyDataCell ret = tv.DequeueReusableCell("xcx") as MyDataCell;

        if (ret == null)
        {
            ret = new MyDataCell(_ev, "xcx");
        }
        else
        {
            ret.UpdateCell(_ev);
        }

        return(ret);
    }
Пример #3
0
        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));
        }