Exemplo n.º 1
0
        public override UITableViewCell GetCell(UITableView tv)
        {
            var cell = tv.DequeueReusableCell(RepositoryTableViewCell.Key) as RepositoryTableViewCell;

            if (cell == null)
            {
                cell = RepositoryTableViewCell.Create();
            }

            if (!string.IsNullOrEmpty(_imageUrl))
            {
                Uri uri;
                cell.Image = Uri.TryCreate(_imageUrl, UriKind.Absolute, out uri) ?
                             ImageLoader.DefaultRequestImage(uri, this) : null;
            }
            else
            {
                cell.Image = _image;
            }

            cell.Owner       = _owner;
            cell.Description = _description;
            cell.Name        = _name;
            return(cell);
        }
Exemplo n.º 2
0
        public float GetHeight(MonoTouch.UIKit.UITableView tableView, MonoTouch.Foundation.NSIndexPath indexPath)
        {
            if (GetRootElement() == null)
            {
                return(44f);
            }

            var cell = GetRootElement().GetOffscreenCell(RepositoryTableViewCell.Key, () => RepositoryTableViewCell.Create());

            cell.Owner       = _owner;
            cell.Description = _description;
            cell.Name        = _name;

            cell.SetNeedsUpdateConstraints();
            cell.UpdateConstraintsIfNeeded();

            cell.Bounds = new RectangleF(0, 0, tableView.Bounds.Width, tableView.Bounds.Height);

            cell.SetNeedsLayout();
            cell.LayoutIfNeeded();

            return(cell.ContentView.SystemLayoutSizeFittingSize(UIView.UILayoutFittingCompressedSize).Height + 1);
        }