Re: VoiceOver and swipe gestures
Re: VoiceOver and swipe gestures
- Subject: Re: VoiceOver and swipe gestures
- From: Fritz Anderson <email@hidden>
- Date: Mon, 05 Dec 2011 13:26:16 -0600
Again, thanks for your help, and I'm sorry I'm apparently so dense.
On 5 Dec 2011, at 11:36 AM, Chris Fleizach wrote:
> Attempting VoiceOver gestures in the simulator won't give you an accurate portrait of how things actually work.
Understood. I've now switched to testing exclusively on my device.
> However, in this case you might want to allow a 3 finger scroll left or right to expand/collapse this view.
>
> You can do that by overriding accessibilityScroll: on that specific view
I got it to recognize three-finger swipes by making the container view an instance of a UIView subclass, implementing only accessibilityScroll:. See the complete @implementaiton at the end of this message.
If I select a view inside the container, and then attempt the scroll gesture, it works. Great.
Issue: If the gesture is the first thing after the application comes to the foreground (at launch or from the background), accessibilityScroll: is never called, and the iPad emits a bongo tone. Selecting a subview restores the three-finger-swipe gesture.
The container view is instantiated (as SwipingView) from the NIB. Initialization from -viewDidLoad assigns into the container's .frame, but immediately posts UIAccessibilityLayoutChangedNotification when it does.
What I've tried:
For the sighted, I attach a gesture recognizer that shifts the container upon a single-finger swipe left or right. I tested without the recognizer. No effect on the issue.
I tried making the container a UIAccessibilityContainer (indexing into its subviews), but that made no difference to the issue.
You can tell I'm flailing. What am I missing?
>> My assumption is that it's tap once to clear the selection, then tap, tap-hold-and-swipe. About 30% of the time, that gesture not merely selects, but triggers, another control that isn't even close to the gesture. I haven't caught on to what's different about the gesture that does that.
>
> That sounds like the right gesture, but again, on the simulator your mileage may vary.
It turned out that the second tap has to be _very_ rapid, and there's no way to adjust it, which surprises me. (Note to self: File a bug.) Once I figured that out, and stuck to the device, there was no problem.
In other news, I hadn't noticed UIAccessibilityTraitAdjustable, which may have me rethinking my slider control and implementing accessibilityIncrement and -Decrement. I wish those methods had examples, or more than ten words of documentation. (Note to self: File a bug.)
— F
@implementation SwipingView
// gTaskView is the view controller.
// It has a @property(nonatomic, assign) BOOL containerIsLeft
// Setting it shifts the container view to match the value.
// For sighted users, the controller attaches a gesture recognizer
// to the container view: Swipe left -> containerIsLeft = NO,
// swipe right -> containerIsLeft = YES.
- (BOOL) accessibilityScroll: (UIAccessibilityScrollDirection) direction
{
NSString * announcement;
switch (direction) {
case UIAccessibilityScrollDirectionLeft:
if (gTaskView.containerIsLeft) {
gTaskView.containerIsLeft = NO;
announcement = @"right-handed";
}
break;
case UIAccessibilityScrollDirectionRight:
if (! gTaskView.containerIsLeft) {
gTaskView.containerIsLeft = YES;
announcement = @"left-handed";
}
break;
default:
return NO;;
}
UIAccessibilityPostNotification(UIAccessibilityPageScrolledNotification,
announcement);
return YES;
}
@end
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Accessibility-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden