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

时光毁灭记忆、已成空白 提交于 2019-12-08 18:43:33

问题


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.


回答1:


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?




回答2:


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.


来源:https://stackoverflow.com/questions/21005119/how-do-i-support-voiceover-in-uipickerview-on-an-ipad-running-an-iphone-only-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!