Inheritance: UICollectionViewCell
示例#1
0
        public override UICollectionViewCell GetCell(UICollectionView collectionView, NSIndexPath indexPath)
        {
            // Dequeue a cell from the reuse pool
            ImageCell imageCell = (ImageCell)collectionView.DequeueReusableCell(cellId, indexPath);

            // Reuse the image declared at the class level
            imageCell.ImageView.Image = image;

            return(imageCell);
        }
		public override UICollectionViewCell GetCell (UICollectionView collectionView, NSIndexPath indexPath)
		{
			// Dequeue a cell from the reuse pool
			// var imageCell = (ImageCell)collectionView.DequeueReusableCell (cellId, indexPath);

			// Reuse the image declared at the class level
			// imageCell.ImageView.Image = image;

			// Inefficient cell and image creation
			ImageCell imageCell = new ImageCell ();
			UIImage image = UIImage.FromFile ("test.png");
			images.Add(image);
			imageCell.ImageView.Image = image;
			
			return imageCell;
		}
        public override UICollectionViewCell GetCell(UICollectionView collectionView, NSIndexPath indexPath)
        {
            // Dequeue a cell from the reuse pool
            // var imageCell = (ImageCell)collectionView.DequeueReusableCell (cellId, indexPath);

            // Reuse the image declared at the class level
            // imageCell.ImageView.Image = image;

            // Inefficient cell and image creation
            ImageCell imageCell = new ImageCell();
            UIImage   image     = UIImage.FromFile("test.png");

            images.Add(image);
            imageCell.ImageView.Image = image;

            return(imageCell);
        }