예제 #1
0
        public override UITableViewCell GetCell(UITableView tableView, MonoTouch.Foundation.NSIndexPath indexPath)
        {
            var item = this.Data[indexPath.Row] as Stock;

            if (item == null)
            {
                return(base.GetCell(tableView, indexPath));
            }

            var cellProvider = tableView as ITableCellProvider;

            if (cellProvider != null)
            {
                return(cellProvider.GetCell(item));
            }

            var cell = tableView.DequeueReusableCell(StockCell.Key) as StockCell;

            if (cell == null)
            {
                cell = StockCell.Create();
                //var views = NSBundle.MainBundle.LoadNib("StockTableCell", cell, null);
                //cell = Runtime.GetNSObject( views.ValueAt(0) ) as StockTableCell;
            }

            cell.Bind(item);

            return(cell);
        }
예제 #2
0
        public UITableViewCell GetCell(Stock stock)
        {
            var newCell = this.DequeueReusableCell(StockCell.Key) as StockCell;

            if (newCell == null)
            {
                newCell = StockCell.Create();
            }

            newCell.Bind(stock);

            return(newCell);
        }
        public UITableViewCell GetCell(object item)
        {
            var stock = item as Stock;

            if (stock == null)
            {
                var cell = new UITableViewCell(UITableViewCellStyle.Value1, "textCell");
                cell.TextLabel.Text = item.ToString();
                return(cell);
            }

            var newCell = this.DequeueReusableCell(StockCell.Key) as StockCell;

            if (newCell == null)
            {
                newCell = StockCell.Create();
            }

            newCell.Bind(stock);

            return(newCell);
        }