public override UITableViewCell GetCell (UITableView tableView, MonoTouch.Foundation.NSIndexPath indexPath)
     {
         UITableViewCell cell = tableView.DequeueReusableCell (_cellIdentifier);
 
         // use the method described in this blog post to wrap a cell in a view controller
         // http://simon.nureality.ca/?p=91
         StockItemTableCellView cellController = null;        
         if (cell == null) {
             cellController = new StockItemTableCellView ();
             NSBundle.MainBundle.LoadNib ("StockItemTableCellView", cellController, null);
             cell = cellController.Cell;
   
             cell.Tag = _sequence++;
             _cellControllers.Add (cell.Tag, cellController);
         } else {
             cellController = _cellControllers [cell.Tag];
         }
 
         // set the state of this cell
         var stockDataItem = _tableItems [indexPath.Row];
         cellController.Symbol = stockDataItem.Symbol;
         cellController.Price = stockDataItem.Price; 
 
         if (stockDataItem.Change > 0.0) {
             cellController.Direction = PriceDirection.Rising;
         } else if (stockDataItem.Change < 0.0) {
             cellController.Direction = PriceDirection.Falling;
         } else {
             cellController.Direction = PriceDirection.NonMover;
         }
         return cell;
     }
示例#2
0
            public override UITableViewCell GetCell(UITableView tableView, MonoTouch.Foundation.NSIndexPath indexPath)
            {
                UITableViewCell cell = tableView.DequeueReusableCell(_cellIdentifier);

                // use the method described in this blog post to wrap a cell in a view controller
                // http://simon.nureality.ca/?p=91
                StockItemTableCellView cellController = null;

                if (cell == null)
                {
                    cellController = new StockItemTableCellView();
                    NSBundle.MainBundle.LoadNib("StockItemTableCellView", cellController, null);
                    cell = cellController.Cell;

                    cell.Tag = _sequence++;
                    _cellControllers.Add(cell.Tag, cellController);
                }
                else
                {
                    cellController = _cellControllers [cell.Tag];
                }

                // set the state of this cell
                var stockDataItem = _tableItems [indexPath.Row];

                cellController.Symbol = stockDataItem.Symbol;
                cellController.Price  = stockDataItem.Price;

                if (stockDataItem.Change > 0.0)
                {
                    cellController.Direction = PriceDirection.Rising;
                }
                else if (stockDataItem.Change < 0.0)
                {
                    cellController.Direction = PriceDirection.Falling;
                }
                else
                {
                    cellController.Direction = PriceDirection.NonMover;
                }
                return(cell);
            }