Beispiel #1
0
        public UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath, FeedItem item)
        {
            if (string.IsNullOrEmpty(item.Id) && string.IsNullOrEmpty(item.AdvertisementUrl))
            {
                if (topCell == null)
                {
                    topCell = new UITableViewCell();
                    topCell.SelectionStyle = UITableViewCellSelectionStyle.None;
                    topCell.Add(view);
                    topCell.AddConstraint(NSLayoutConstraint.Create(view, NSLayoutAttribute.Left, NSLayoutRelation.Equal, topCell, NSLayoutAttribute.Left, 1, 0));
                    topCell.AddConstraint(NSLayoutConstraint.Create(view, NSLayoutAttribute.Top, NSLayoutRelation.Equal, topCell, NSLayoutAttribute.Top, 1, 0));
                    topCell.AddConstraint(NSLayoutConstraint.Create(view, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, topCell, NSLayoutAttribute.Bottom, 1, 0));
                    topCell.AddConstraint(NSLayoutConstraint.Create(view, NSLayoutAttribute.Right, NSLayoutRelation.Equal, topCell, NSLayoutAttribute.Right, 1, 0));
                    //AppDelegate.SetViewFont (topCell);
                }
                topCell.SelectionStyle = UITableViewCellSelectionStyle.None;

                return(topCell);
            }
            if (!string.IsNullOrEmpty(item.AdvertisementUrl))
            {
                var cell = tableView.DequeueReusableCell("AdvertisementCell", indexPath) as AdvertisementCell;
                //cell.Position = indexPath.Row;
                cell.SetData(item);
                cell.SelectionStyle = UITableViewCellSelectionStyle.None;
                return(cell);
            }
            else
            {
                var cell = tableView.DequeueReusableCell("FeedCell", indexPath) as FeedCell;
                cell.Position = indexPath.Row;
                SetNewsFeedCellCommon(cell, item);
                cell.SetNeedsUpdateConstraints();
                cell.SetNeedsLayout();
                cell.SelectionStyle = UITableViewCellSelectionStyle.None;
                return(cell);
            }
        }