1
votes

I have a custom view. I capture the screenshot of view and use image in NSTextAttachment as :

UIImage *image = view.image;
    NSTextAttachment *attachment = [NSTextAttachment new];
    attachment.image = image;

I then create a mutable Attributed string with this attachment as:

NSAttributedString *attrStr = [NSAttributedString attributedStringWithAttachment:attachment];

This code is looped for all views and one final attributed string is created by appending all attrStr's as:

[mutableString beginEditing];
    [mutableString appendAttributedString:attrStr];
    [mutableString endEditing];

This is then set to UILabel attributed text.

Problem : I want voice over to iterate through individual images in attributed text. So that each image is in focus by voice over.

Thanks !!

1

1 Answers

0
votes

The best way to iterate through individual images (like a collection view for instance) relies on the fact to define each element as a UIAccessibilityElement inside a wrapper whose trait property is adjustable.

To understand how that should be implemented, I suggest you take a look at the WWDC 2018 - Deliver an exceptional accessibility experience video whose content is perfectly summarized here and whose presented example can be downloaded.

Use of UIAccessibilityContainer protocol could be an interesting track of investigation as well.

Finally, I don't think you could iterate your images inside the attributed text as is but creating a kind of accessible structure perfectly understandable by VoiceOver as defined before would allow to reach your goal.