3

I've got a set of UIImageViews contained inside of a UIScrollView. For some reason, when I go to have Voice Over read all the elements on the page, it does not read the ImageView like it should. I set up the UIImageView's accessibility info like so:

if (self.featuresModel.imageText) {
    self.featureImage.isAccessibilityElement = YES;
    self.featureImage.accessibilityLabel = self.featuresModel.imageText;
}

I've checked that the UIScrollView is not set to be accessible, so it's not intercepting the touches. It seems to show it will work in the simulator, when I click on the image it pops up the correct label and highlights the correct area, however, on a physical device, clicking or trying to read all elements on the page does nothing when it gets to the UIImageView.

Any ideas on how to remedy this issue?

Edit: The scrollView class is a custom subclass of UIScrollView that doesn't implement UIAccessiblity protocol directly, however, since it uses a UIScrollView as its underlying data structure, I don't think this should matter much, however, as I still don't know much about UIAccessibility I thought I should mention it.

Bill L
  • 2,576
  • 4
  • 28
  • 55
  • does voice over hightlight the imageview or skips it ? – Teja Nandamuri Oct 02 '15 at 16:15
  • Simply skips it. I don't know if this matters, but my scrollView is a bit custom, and the custom subclass doesn't implement UIAccessibilityProtocol, however, I don't think that should matter since it inherits from UIScrollView – Bill L Oct 02 '15 at 16:19
  • did you turn on the accessibility for your imageview on storyboard ? – Teja Nandamuri Oct 02 '15 at 16:20
  • I did not, it's all done programmatically. In the nib the imageView isn't set to be accessible, however if the text I need is available, I set it to be accessible in the code above. I've set breakpoints and have confirmed that the programmatic turning on of accessibility is getting reached by the code. – Bill L Oct 02 '15 at 16:25
  • you have to enable the accessibility in nib, if you are creating the imageview in nib. Even though you set the accessibility element value to yes, voice doesnt read it. – Teja Nandamuri Oct 02 '15 at 16:26
  • Does the problem reproduce using a standard `UIScrollView`? – Justin Oct 02 '15 at 16:28
  • I beleive scrollview has nothing to do with accessibility. Voice over doesnt recognises scroll view. It just reads the elements in it. – Teja Nandamuri Oct 02 '15 at 16:29
  • @Mr.T That was exactly it! Weird, this view controller is presented in two different ways, one of the ways it worked, the second way it did not work, but flipping that switch did it. If you add that as an answer I'll accept it if you'd like, thanks so much for the help! – Bill L Oct 02 '15 at 16:30

1 Answers1

3

Make sure you enabled the accessibility for your imageview on storyboard/nib.

IF you set the isAccessibilityElement to YES, the voice over highlights it and reads it. Again the accessibility for that element should be enalbled in nib.

IF you set the isAccessibilityElement to NO, the voice over doesnt highlights it and doesnt reads it, even the accessibility for that element is enalbled in nib.

Note: Voice over doesnt care about scrolview.It only care about the elements in the scroll view. You can change the order of the accessibility elements if you want.Or you can disable the accessibility for the elements in the scroll view.

Teja Nandamuri
  • 11,045
  • 6
  • 57
  • 109