public override UICollectionViewCell GetCell(UICollectionView collectionView, NSIndexPath indexPath) { var cell = (UserCellAttribute)collectionView.DequeueReusableCell(UserCellAttribute.CellID, indexPath); ImageCellAttribute row = Cells[indexPath.Row]; cell.UpdateRow(row, ImageViewSize); return(cell); }
public override void ItemUnhighlighted(UICollectionView collectionView, NSIndexPath indexPath) { //Get the Selected Image var cell = (UserCellAttribute)collectionView.CellForItem(indexPath); ImageCellAttribute Clicked = Cells[indexPath.Row]; /* * Sends image clicked to the RightAttributes table view * Updates the source to show only attributes for the selected image. */ if (ImageClickedToController != null && isAttributesTab) { ImageClickedToController(Clicked.ImgOBJ); } }
public override void ItemHighlighted(UICollectionView collectionView, NSIndexPath indexPath) { /* * Fix this when switching attributes */ var cell = (UserCellAttribute)collectionView.CellForItem(indexPath); ImageCellAttribute Clicked = Cells[indexPath.Row]; SelectedImagesToClear.Add(indexPath); if (mainCollectionView == null) { mainCollectionView = collectionView; } /* * Select/Deselect Images and keep them Highlighted */ if (isAttributesTab) { //unclick the previous image if (prevImageSelected != null && prevImageSelected != indexPath) { Cells[prevImageSelected.Row].isSelected = false; prevCell.ImageView.Layer.BorderColor = UIColor.Gray.CGColor; prevCell.ImageView.Layer.BorderWidth = 1f; prevCell.ImageView.Layer.CornerRadius = 5f; prevCell.ImageView.Layer.MasksToBounds = true; //prevCell.ImageView.Alpha = 1.0f; } //always highlight the currently selected image //cell.ImageView.Alpha = 0.5f; cell.ImageView.Layer.BorderColor = AppColors.PEACH.CGColor; cell.ImageView.Layer.BorderWidth = 10f; cell.ImageView.Layer.CornerRadius = 5f; cell.ImageView.Layer.MasksToBounds = true; Cells[indexPath.Row].isSelected = true; prevCell = (UserCellAttribute)collectionView.CellForItem(indexPath); } /* * Image Stacks functionality. This adds Selected images to the array * to be able to delete images from this image stack. */ else { if (Clicked.isSelected) { cell.ImageView.Layer.BorderColor = UIColor.Gray.CGColor; cell.ImageView.Layer.BorderWidth = 1f; cell.ImageView.Layer.CornerRadius = 5f; cell.ImageView.Layer.MasksToBounds = true; //cell.ImageView.Alpha = 1.0f; Clicked.isSelected = false; //remove the object from the list SelectedImagesToImageStack.Remove(Clicked.ImgOBJ); } else { cell.ImageView.Layer.BorderColor = AppColors.PEACH.CGColor; cell.ImageView.Layer.BorderWidth = 10f; cell.ImageView.Layer.CornerRadius = 5f; cell.ImageView.Layer.MasksToBounds = true; //cell.ImageView.Alpha = 0.5f; Clicked.isSelected = true; //add the image object to the list SelectedImagesToImageStack.Add(Clicked.ImgOBJ); } } prevImageSelected = indexPath; }
public void UpdateRow(ImageCellAttribute element, SizeF imageViewSize) { ImageView.Image = Utilities.GetUIImageFromFileNameThumbnail(element.ImgOBJ.FileName); //ImageView.Layer.CornerRadius = 20f; ImageView.Frame = new RectangleF(0, 0, imageViewSize.Width, imageViewSize.Height); }