Question

I have a selector control in my app based on UITableView. The user can scroll the table view and a marker in the center shows selected item. Every selectable item is a table view cell.

Example: enter link description here Now I want to make my app VoiceOver compatible for a friend. But this control, I have trouble make it work.

With VoiceOver on, I cant scroll the table view to select other elements. I looked at picker view in clocks app. It does not scroll too. But when you flick up or down it jumps to the next or previous value. It says

"swipe up or down with one finger to adjust the value".

I read Matt Gammell's VoiceOver guide where he sais the hint must say what the control does not what you should do.

So I infer this is a special trait they use for things that can swipe up or down to adjust value. But I cant find such trait.

Since UIPickerView is based on UITableViews how did Apple make it work with VoiceOver? Must I use gesture recognizer for flick?

EDIT:

I am setting the adjustable trait on the UITableView subclass like this:

self.isAccessibilityElement = YES;
self.accessibilityLabel = @"Start date.";
self.accessibilityTraits = UIAccessibilityTraitAdjustable;

The table view implements

- (void)accessibilityIncrement {
    NSLog(@"accessibilityIncrement");
}

- (void)accessibilityDecrement {
    NSLog(@"accessibilityDecrement");
}

Now I can drag across cells and VoiceOver will read their labels and mark them with the black rectangle. But table view does not scroll and the methods above dont get called.

The cells themselves are isAccessibilityElement = NO; and dont implement accessibility action methods.

Était-ce utile?

La solution

You are looking for the adjustable trait: UIAccessibilityTraitAdjustable.

If you specify this trait on your view/cell you must also implement accessibilityIncrement and accessibilityDecrement in that view/cell. These are the two methods that get called when the user swipes up and down with one finger.

There is no need to implement any gesture recognizers yourself. Setting the trait is enough to get that behavior (it will also add the "swipe up or down with one finger ..." description)

Autres conseils

You add the UIAccessibilityTraitAdjustable to the element's traits. Then you implement the -(void)accessibilityIncrement and -(void)accessibilityDecrement actions. In the case of the date picker, you should do this for each component (year, month, date) - each of these is an element (which the user can move the VoiceOver cursor to by flicking left and right) and each is adjustable (by flicking up/down while the VoiceOver cursor is on it).

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top