Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I support VoiceOver in UIPickerView on an iPad running an iPhone only app (non-universal)?

Generally I look at Apple's UICatalog sample code for basic VoiceOver support however it looks like there is VoiceOver support for UIPickerViews in the sample code. Do I need to provide an accessibilityLabel method somewhere to add VoiceOver support? I tried to implement UIPickerViewAccessibilityDelegate methods but voice over only reads the labels in my picker view and not the hint to swipe up or down to change the values.

Also my picker view is set to the input view of a UITextField. So I'm not sure if that is relevant or not.

Update: https://github.com/stevemoser/VoiceOverPicker

I created a sample project demonstrating the issue. In the example there is a normal picker view shown and a textfield. There is also a picker that is set to the textfield's input view property. I can't seem to activate the either picker just by tapping on it while using VoiceOver. Though I can activate either one by swiping (left and right) through the views on screen. Any ideas?

Update 2: Looks like if the app is an iPhone app running on an iPhone or an iPad app running on an iPad it works fine but if it is an iPhone only app running on an iPad, tapping to select a UIPickerView doesn't work.

like image 639
Steve Moser Avatar asked Jan 08 '14 19:01

Steve Moser


Video Answer


2 Answers

Are you just doing a vanilla UIPickerView using titles for each row (and not custom views)? If so, there isn't anything that you should have to do.

You mentioned that VoiceOver was correctly reading the label on each row, so we know that the UIPickerView correctly has isAccessibilityElement set to YES. It's also correctly reading the accessibilityLabels.

Is it possible that you're interacting with the picker before it has a chance to read the accessibilityHint? (For the benefit of others, the accessibilityHint is the "swipe or down with one finger to adjust the value" that Steve mentioned in his question.) Or perhaps some notification is changing the VoiceOver focus before the hint has a chance to be read?

like image 107
ceperry Avatar answered Sep 18 '22 16:09

ceperry


By default, if your picker view is accessible, when you focus on it with VoiceOver it will read the something along these lines:

"[ROW LABEL] Adjustable [#number] out of [#total] picker item" a 2 to 3 second pause then "Swipe up or down to select value"

A few of things to note:

  1. There is a 2 to 3 second delay between reading the label and the hint, make sure you wait for it.
  2. If you're providing your own hint, the default one will not get read I believe
  3. Hints are only read when you reach a certain control by either directly pressing it or by swiping right or left to the control. it will not get read if you do a 2 finger swipe down or up.
  4. Make sure you're testing on an actual device and not a simulator as it does not show all of the things VoiceOver announces.
like image 42
Feras Arabiat Avatar answered Sep 16 '22 16:09

Feras Arabiat