public override UITableViewCell GetCell(UITableView tv)
        {
            var cell = tv.DequeueReusableCell(NewsCellView.Key) as NewsCellView ?? NewsCellView.Create();

            cell.Set(_imageUri, _time, _actionImage, _attributedHeader, _attributedBody, _headerLinks, _bodyLinks, WebLinkClicked, _multilined);
            return(cell);
        }
Esempio n. 2
0
        public override float GetHeightForRow(MonoTouch.UIKit.UITableView tableView, MonoTouch.Foundation.NSIndexPath indexPath)
        {
            if (_usedForHeight == null)
            {
                _usedForHeight = (NewsCellView)tableView.DequeueReusableCell(NewsCellView.Key);
            }

            var item = ItemAt(indexPath) as EventItemViewModel;

            if (item != null)
            {
                var s = 6f + NewsCellView.TimeFont.LineHeight + 5f + (NewsCellView.HeaderFont.LineHeight * 2) + 4f + 7f;
                _usedForHeight.ViewModel = item;

                if (_usedForHeight.BodyString.Length == 0)
                {
                    return(s);
                }

                var rec    = _usedForHeight.BodyString.GetBoundingRect(new SizeF(tableView.Bounds.Width - 56, 10000), NSStringDrawingOptions.UsesLineFragmentOrigin | NSStringDrawingOptions.UsesFontLeading, null);
                var height = rec.Height;

                if (item.BodyBlocks.Count == 1 && height > (CharacterHeight * 4))
                {
                    height = CharacterHeight * 4;
                }

                var descCalc = s + height;
                var ret      = ((int)Math.Ceiling(descCalc)) + 1f + 8f;
                return(ret);
            }

            return(base.GetHeightForRow(tableView, indexPath));
        }
Esempio n. 3
0
        public override UITableViewCell GetCell(UITableView tv)
        {
            var cell = tv.DequeueReusableCell(NewsCellView.Key) as NewsCellView ?? NewsCellView.Create();

            return(cell);
        }
Esempio n. 4
0
 public EventTableViewSource(UITableView tableView, IReactiveNotifyCollectionChanged <EventItemViewModel> collection)
     : base(tableView, collection, NewsCellView.Key, 100f)
 {
     _cache = new TableViewCellHeightCache <NewsCellView, EventItemViewModel>(100f, () => NewsCellView.Create(true));
     tableView.SeparatorInset = NewsCellView.EdgeInsets;
     tableView.RegisterNibForCellReuse(NewsCellView.Nib, NewsCellView.Key);
 }