Accessibility on UIPickerView

By Alex M, 6 May, 2016

Forum
App Development and Programming
Hello, I recently started work on making my app accessible. After I used VoiceOver on it, I realized that it was really lacking in that regard. Now I'd like to do as good a job as I can and make it convenient to use. This is my first foray into accessibility. I found most things easy to do, but stumbled into one issue that I have no idea how to solve, even after hours of googling and trial-and-error. So I have a somewhat customized UIPickerView in my app. Basically I use pickerView:viewForRow:forComponent:reusingView delegate method returning a simple UILabel, to achieve better formatting. I noticed that VoiceOver reads label and adds, say, "3 of 300" (i.e. row number "of" total rows). This is not a desired behavior for my app. While trying to troubleshoot this, I found that if I use pickerView:titleForRow:forComponent instead, without any other changes, then I get the desired behavior of VoiceOver simply reading the "title" of the selected row. I tested this on iOS 9. Question is: how do I get UIPickerView back to the "normal" VoiceOver behavior, while still using pickerView:viewForRow:forComponent:reusingView? I didn't get any answers on StackOverflow. Asked Apple for help, but don't know how soon they will reply. I'm hoping that perhaps there are people on this forum with exactly the right experience. Thank you!

Options

Comments

By Dax Rahusen on Monday, May 23, 2016 - 05:44

Dear Alex,

Could you provide us with some class data?
You said you made a subclass of UIPickerView.
Maybe a github?

Good luck.

Greetings,

Dax

By Alex M on Monday, May 23, 2016 - 05:44

Hi Dax, Actually I didn't subclass UIPickerView. To customize picker's visual appearance by using its delegate methods. Part of that customization was to return UILabel from pickerView:viewForRow:forComponent:reusingView to have control over font family and size shown in the picker. I asked Apple how to fix this accessibility issue. And guess what their answer was: it is impossible to fix on current iOS versions! I came up with a workaround, that was fairly painless. You can read my question and answer on StackOverflow: https://stackoverflow.com/questions/37041272/ios-unexpected-voiceover-behavior-on-customized-uipickerview Cheers, -Alex