示例#1
0
            public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
            {
                UITableViewCell       cell           = tableView.DequeueReusableCell(kCellIdentifier);
                Session               s              = _sessions[indexPath.Row];
                SessionCellController cellController = null;

                if (cell == null)
                {
                    Console.WriteLine("no cell");
                    cellController = new SessionCellController();
                    NSBundle.MainBundle.LoadNib("SessionCellController", cellController, null);
                    cell     = cellController.Cell;
                    cell.Tag = Environment.TickCount;
                    controllers.Add(cell.Tag, cellController);
                }
                else
                {
                    Console.WriteLine("reuse cell");
                    cellController = controllers[cell.Tag];
                }
                Console.WriteLine("setting disclosure");
                cell.Accessory = UITableViewCellAccessory.DisclosureIndicator;
                Console.WriteLine("loading data");
                try
                {
                    cellController.SessionTitle = s.Title;
                    cellController.Subtitle     = s.Location;
                    cellController.Time         = s.StartTime;
                    cellController.EndTime      = s.EndTime;
                } catch (Exception) {}
                return(cell);
            }
            public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
            {
                UITableViewCell cell = tableView.DequeueReusableCell (kCellIdentifier);
                Session s = _sessions[indexPath.Row];
                SessionCellController cellController = null;

                if (cell == null)
                {
                    Console.WriteLine("no cell");
                    cellController = new SessionCellController();
                    NSBundle.MainBundle.LoadNib("SessionCellController", cellController, null);
                    cell = cellController.Cell;
                    cell.Tag = Environment.TickCount;
                    controllers.Add(cell.Tag, cellController);
                }
                else
                {
                    Console.WriteLine("reuse cell");
                    cellController = controllers[cell.Tag];
                }
                Console.WriteLine("setting disclosure");
                cell.Accessory = UITableViewCellAccessory.DisclosureIndicator;
                Console.WriteLine("loading data");
                try
                {
                cellController.SessionTitle = s.Title;
                cellController.Subtitle = s.Location;
                cellController.Time = s.StartTime;
                cellController.EndTime = s.EndTime;
                } catch (Exception){}
                return cell;
            }