示例#1
0
        /// <summary>
        /// Called by the TableView to get the actual UITableViewCell to render for the particular section and row
        /// </summary>
        public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
        {
            // request a recycled cell to save memory
            NativeiOSListViewCell cell = tableView.DequeueReusableCell(cellIdentifier) as NativeiOSListViewCell;

            // if there are no cells to reuse, create a new one
            if (cell == null)
            {
                cell = new NativeiOSListViewCell(cellIdentifier);
            }

            if (String.IsNullOrWhiteSpace(tableItems [indexPath.Row].ImageFilename))
            {
                cell.UpdateCell(tableItems [indexPath.Row].Name
                                , tableItems [indexPath.Row].Category
                                , null);
            }
            else
            {
                cell.UpdateCell(tableItems[indexPath.Row].Name
                                , tableItems[indexPath.Row].Category
                                , UIImage.FromFile("Images/" + tableItems[indexPath.Row].ImageFilename + ".jpg"));
            }

            return(cell);
        }
		/// <summary>
		/// Called by the TableView to get the actual UITableViewCell to render for the particular section and row
		/// </summary>
		public override UITableViewCell GetCell (UITableView tableView, NSIndexPath indexPath)
		{
			// request a recycled cell to save memory
			NativeiOSListViewCell cell = tableView.DequeueReusableCell (cellIdentifier) as NativeiOSListViewCell;

			// if there are no cells to reuse, create a new one
			if (cell == null) {
				cell = new NativeiOSListViewCell (cellIdentifier);
			}

			if (String.IsNullOrWhiteSpace (tableItems [indexPath.Row].ImageFilename)) {
				cell.UpdateCell (tableItems [indexPath.Row].Name
				, tableItems [indexPath.Row].Category
				, null);
			} else {
				cell.UpdateCell (tableItems[indexPath.Row].Name
					, tableItems[indexPath.Row].Category
					, UIImage.FromFile ("Images/" +tableItems[indexPath.Row].ImageFilename + ".jpg") );
			}

			return cell;
		}