Example #1
0
        public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
        {
            BubbleCell cell = null;
            var        msg  = viewModel.Messages [indexPath.Row];

            cell = (BubbleCell)tableView.DequeueReusableCell(GetReuseId(msg));
            cell.ApplyCurrentTheme();
            cell.MessageLbl.TextColor = msg.IsIncoming ? Theme.Current.IncomingTextColor : Theme.Current.OutgoingTextColor;
            cell.Message = msg;

            return(cell);
        }
Example #2
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);
        }