public override UITableViewCell GetCell(UITableView tv) { var c = tv.DequeueReusableCell(GistCellView.Key) as GistCellView ?? GistCellView.Create(); c.Set(_title, _gist.Description, _gist.CreatedAt, new GitHubAvatar(_gist.Owner?.AvatarUrl)); return(c); }
public override UITableViewCell GetCell(UITableView tv) { var cell = tv.DequeueReusableCell(GistCellView.Key) as GistCellView ?? GistCellView.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.Time = _time; cell.Content = _description; cell.Title = _name; return(cell); }
public float GetHeight(MonoTouch.UIKit.UITableView tableView, MonoTouch.Foundation.NSIndexPath indexPath) { if (GetRootElement() == null) { return(44f); } var cell = GetRootElement().GetOffscreenCell(GistCellView.Key, () => GistCellView.Create()); cell.Time = _time; cell.Content = _description; cell.Title = _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); }
public GistTableViewSource(UITableView tableView, IReactiveNotifyCollectionChanged <GistItemViewModel> collection) : base(tableView, collection, GistCellView.Key, UITableView.AutomaticDimension, 60f) { _cache = new TableViewCellHeightCache <GistCellView, GistItemViewModel>(60f, () => GistCellView.Create(true)); tableView.RegisterNibForCellReuse(GistCellView.Nib, GistCellView.Key); }