@@ -507,7 +507,7 @@ public override void WillAnimateRotation (UIInterfaceOrientation toInterfaceOrie
507507 _imageManager . RequestImageForAsset ( typedCell . Asset ,
508508 AssetGridThumbnailSize ,
509509 PHImageContentMode . AspectFill ,
510- options ,
510+ options ,
511511 ( image , info ) => {
512512 // Only update the thumbnail if the cell tag hasn't changed. Otherwise, the cell has been re-used.
513513 if ( cell . Tag == currentTag && typedCell . ImageView != null && image != null ) {
@@ -563,7 +563,13 @@ public override UICollectionViewCell GetCell(UICollectionView collectionView, NS
563563 {
564564 cell . Selected = false ;
565565 }
566-
566+
567+ var resources = PHAssetResource . GetAssetResources ( asset ) ;
568+ var name = resources != null && resources . Length > 0
569+ ? resources [ 0 ] . OriginalFilename
570+ : string . Empty ;
571+
572+ ConfigureSelectCellAccessibilityAttributes ( cell , cell . Selected , name ) ;
567573 return cell ;
568574 }
569575
@@ -609,7 +615,8 @@ public override bool ShouldSelectItem(UICollectionView collectionView, NSIndexPa
609615 var asset = ( PHAsset ) AssetsFetchResults [ indexPath . Item ] ;
610616
611617 var cell = ( GMGridViewCell ) collectionView . CellForItem ( indexPath ) ;
612-
618+ ConfigureSelectCellAccessibilityAttributes ( cell , true , null ) ;
619+
613620 if ( ! cell . IsEnabled )
614621 {
615622 return false ;
@@ -623,12 +630,34 @@ public override bool ShouldSelectItem(UICollectionView collectionView, NSIndexPa
623630 public override void ItemDeselected ( UICollectionView collectionView , NSIndexPath indexPath )
624631 {
625632 var asset = ( PHAsset ) AssetsFetchResults [ indexPath . Item ] ;
633+ var cell = ( GMGridViewCell ) collectionView . CellForItem ( indexPath ) ;
626634
627635 _picker . DeselectAsset ( asset ) ;
628636 _picker . NotifyAssetDeselected ( asset ) ;
637+ ConfigureSelectCellAccessibilityAttributes ( cell , false , null ) ;
629638 }
630- }
639+
640+ #region Voiceover Accessibility Configuration
641+ private static void ConfigureSelectCellAccessibilityAttributes ( GMGridViewCell selectedCell , bool isSelected , string imageName )
642+ {
643+ selectedCell . AccessibilityTraits = UIAccessibilityTrait . Button ;
644+ selectedCell . IsAccessibilityElement = true ;
645+ if ( imageName != null )
646+ {
647+ selectedCell . AccessibilityLabel = imageName ;
648+ }
631649
650+ if ( ! isSelected )
651+ {
652+ selectedCell . AccessibilityHint = "picker.accessibility.check-to-select" . Translate ( defaultValue : "Check to select the image" ) ;
653+ }
654+ else
655+ {
656+ selectedCell . AccessibilityHint = "picker.accessibility.uncheck-to-deselect" . Translate ( defaultValue : "Uncheck to deselect the image" ) ; ;
657+ }
658+ }
659+ #endregion
660+ }
632661 #endregion
633662}
634663
0 commit comments