Example #1
0
        nfloat CalculateHeightFor(MessageViewModel msg, UITableView tableView)
        {
            var        index = msg.IsIncoming ? 0 : 1;
            BubbleCell cell  = sizingCells [index];

            if (cell == null)
            {
                cell = sizingCells [index] = (BubbleCell)tableView.DequeueReusableCell(GetReuseId(msg));
            }

            cell.ApplyCurrentTheme();
            cell.Message = msg;

            cell.SetNeedsLayout();
            cell.LayoutIfNeeded();
            CGSize size = cell.ContentView.SystemLayoutSizeFittingSize(UIView.UILayoutFittingCompressedSize);

            return(NMath.Ceiling(size.Height) + 1);
        }