Пример #1
0
        public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
        {
            if (indexPath.Row != 0) {
                var cell = tableView.DequeueReusableCell (cellIdentifier) as NewsCell;
                if (cell == null) {
                    cell = new NewsCell (cellIdentifier);
                }

                if (!string.IsNullOrEmpty (items [indexPath.Row - 1].Img)) {
                    // set the cell props
                    // we subtract one from the index because of the featured cell
                    cell.SetNewsCell (items [indexPath.Row - 1].Title, items [indexPath.Row - 1].Category,
                                      items [indexPath.Row - 1].Img);

                }
                else {
                    cell.SetNewsCell (items [indexPath.Row - 1].Title, items [indexPath.Row - 1].Category, UIImage.FromFile("./Assets/imgholder.png"));
                }

                cell.ContentView.BackgroundColor = UIColor.FromRGB (26, 26, 26);
                return cell;
            }
            else {
                var cell = tableView.DequeueReusableCell(cellIdentifier) as FeaturedCell;
                if (cell == null) {
                    cell = new FeaturedCell (cellIdentifier);
                }
                for (int i = 0; i < 4; i++) {
                    cell.SetFeaturedCell (featured);
                }
                cell.ContentView.BackgroundColor = UIColor.FromRGB (26, 26, 26);
                return cell;
            }
        }
Пример #2
0
        public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
        {
            if (indexPath.Row != 0) {
                var cell = tableView.DequeueReusableCell (cellId);
                if (cell == null) {
                    cell = new UITableViewCell (UITableViewCellStyle.Default, cellId);
                }
                cell.SelectionStyle = UITableViewCellSelectionStyle.None;
                cell.TextLabel.Text = items [indexPath.Row - 1].Name;
                cell.TextLabel.Font = UIFont.FromName ("Helvetica-Bold", 14f);
                cell.TextLabel.TextColor = UIColor.White;
                cell.TextLabel.BackgroundColor = UIColor.Clear;
                cell.ContentView.BackgroundColor = UIColor.FromPatternImage(UIImage.FromFile("./Assets/cell.png"));

                return cell;
            }
            else {
                var cell = tableView.DequeueReusableCell(featuredCellId) as FeaturedCell;
                if (cell == null) {
                    cell = new FeaturedCell (featuredCellId);
                }
                cell.SetFeaturedCell (featured);
                cell.ContentView.BackgroundColor = UIColor.FromRGB (26, 26, 26);
                return cell;
            }
        }