Ejemplo n.º 1
0
        public override float GetHeightForRow(MonoTouch.UIKit.UITableView tableView, MonoTouch.Foundation.NSIndexPath indexPath)
        {
            if (_usedForHeight == null)
            {
                _usedForHeight = (RepositoryCellView)tableView.DequeueReusableCell(RepositoryCellView.Key);
            }

            var item = ItemAt(indexPath) as RepositoryItemViewModel;

            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));
        }
Ejemplo n.º 2
0
        public override UITableViewCell GetCell(UITableView tv)
        {
            var cell = tv.DequeueReusableCell(CellKey) as RepositoryCellView ?? RepositoryCellView.Create();

            return(cell);
        }
Ejemplo n.º 3
0
        public override UITableViewCell GetCell(UITableView tv)
        {
            var cell = tv.DequeueReusableCell(RepositoryCellView.Key) as RepositoryCellView ?? RepositoryCellView.Create();

            cell.Bind(_name, _description, ShowOwner ? _owner : null, _avatar);
            return(cell);
        }
Ejemplo n.º 4
0
        public float GetHeight(UITableView tableView, NSIndexPath indexPath)
        {
            if (GetRootElement() == null)
            {
                return(44f);
            }

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

            cell.Bind(_name, _followers.ToString(), _forks.ToString(), _description, ShowOwner ? _owner : null, _image);

            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);
        }
Ejemplo n.º 5
0
        public override UITableViewCell GetCell(UITableView tv)
        {
            var cell = tv.DequeueReusableCell(RepositoryCellView.Key) as RepositoryCellView ?? RepositoryCellView.Create();

            if (_image == null && _imageUri != null)
            {
                _image = ImageLoader.DefaultRequestImage(_imageUri, this);
            }
            cell.Bind(_name, _followers.ToString(), _forks.ToString(), _description, ShowOwner ? _owner : null, _image);
            return(cell);
        }
Ejemplo n.º 6
0
 public RepositoryTableViewSource(UITableView tableView)
     : base(tableView, UITableView.AutomaticDimension, _estimatedHeight)
 {
     _cache = new TableViewCellHeightCache <RepositoryCellView, RepositoryItemViewModel>(_estimatedHeight, () => RepositoryCellView.Create(true));
     tableView.RegisterNibForCellReuse(RepositoryCellView.Nib, RepositoryCellView.Key);
 }