public override void WillDisplayAssetItem(ImagePickerController controller, ImagePickerAssetCell cell, PHAsset asset) { switch (cell) { case var _ when cell is CustomVideoCell videoCell: videoCell.Label.Text = GetDurationFormatter().StringFromTimeInterval(asset.Duration); break; case var _ when cell is CustomImageCell imageCell: switch (asset.MediaSubtypes) { case PHAssetMediaSubtype.PhotoLive: imageCell.SubtypeImage.Image = UIImage.FromBundle("icon-live"); break; case PHAssetMediaSubtype.PhotoPanorama: imageCell.SubtypeImage.Image = UIImage.FromBundle("icon-pano"); break; default: { if (UIDevice.CurrentDevice.CheckSystemVersion(10, 2) && asset.MediaSubtypes == PHAssetMediaSubtype.PhotoDepthEffect) { imageCell.SubtypeImage.Image = UIImage.FromBundle("icon-depth"); } break; } } break; } }
public void WillDisplayAssetCell(ImagePickerAssetCell cell, int index) { var theAsset = Asset(index); //if the cell is default cell provided by Image Picker, it's our responsibility //to update the cell with the asset. var defaultCell = cell as VideoAssetCell; defaultCell?.Update(theAsset); Delegate?.WillDisplayAssetItem(this, cell, theAsset); }
/// <summary> /// Called right before an asset item collection view cell is displayed. Use this method /// to configure your cell based on asset media type, subtype, etc. /// </summary> /// <param name="controller">Controller.</param> /// <param name="cell">Cell.</param> /// <param name="asset">Asset.</param> public virtual void WillDisplayAssetItem(ImagePickerController controller, ImagePickerAssetCell cell, PHAsset asset) { }