图像选择器iOS可访问性问题

时间:2015-07-28 05:37:11

标签: ios objective-c iphone image voiceover

我正在尝试构建一个也可访问的应用。它与图像有关,所以我使用这个名为ELCImagePickerController(https://github.com/B-Sides/ELCImagePickerController)的免费开源工具作为图像选择器。它允许用户一次选择多个图像。但这是无法获得的。 Voice Over不是选择每个单独的图像,而是一次选择整行。

我尝试通过添加以下内容为“ELCAsset.m”中的每个单独图片添加配音标签:

    NSDate *date = [self.asset valueForProperty:ALAssetPropertyDate];
    NSString *orientation = [self.asset valueForProperty:ALAssetPropertyOrientation];
    NSString *type = [self.asset valueForProperty:ALAssetPropertyType];
    CLLocation *location = [self.asset valueForProperty:ALAssetPropertyLocation];

    self.asset.accessibilityLabel = [NSString stringWithFormat:@"%@. %@. %@. %@.", type, orientation, date, location];

就是这个方法:

- (void)setSelected:(BOOL)selected

但是,不是VoiceOver选择一个图像,而是一次选择整行。这就是它的作用:

enter image description here

我希望它一次只选择一个图像而不是一行。关于如何做到这一点的任何想法?

1 个答案:

答案 0 :(得分:0)

Anything that VoiceOver focuses has the property accessibilityElement set to YES. VoiceOver will not focus accessibility elements that are contained within other accessibility elements. So, you have to do the following

NSDate *date = [self.asset valueForProperty:ALAssetPropertyDate];
NSString *orientation = [self.asset valueForProperty:ALAssetPropertyOrientation];
NSString *type = [self.asset valueForProperty:ALAssetPropertyType];
CLLocation *location = [self.asset valueForProperty:ALAssetPropertyLocation];

self.asset.accessibilityLabel = [NSString stringWithFormat:@"%@. %@. %@. %@.", type, orientation, date, location];

//And additionally:
self.superview.isAccessibilityElement = NO;

The superview, meaning the container view that is behaving as a row of images. This may actually be self.superview.superview, or self.superview.superview.superview... Depending on how the container is implemented.