我开发了一个应用程序,允许用户在 Canvas 上绘制他的手指签名。 此功能是使用带有特定目标操作的 UIPanGestureRecognizer 在 UIView 中绘制一条线来实现的,但是当“Voice Over”处于事件状态时,手势识别器操作不再触发。
手势初始化代码
UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc] initWithTarget:self actionselector(pan];
pan.maximumNumberOfTouches = pan.minimumNumberOfTouches = 1;
[self addGestureRecognizer:pan];
手势 Action 代码
- (void)panUIPanGestureRecognizer *)pan {
CGPoint currentPoint = [pan locationInView:self];
CGPoint midPoint = midpoint(previousPoint, currentPoint);
if (pan.state == UIGestureRecognizerStateBegan)
{
[path moveToPoint:currentPoint];
}
else if (pan.state == UIGestureRecognizerStateChanged)
{
[path addQuadCurveToPoint:midPoint controlPoint:previousPoint];
}
previousPoint = currentPoint;
[self setNeedsDisplay];
}
有没有办法在“画外音”处于事件状态时使用手势在 View 中画线?
感谢和问候!
我解决了我为 UIView Canvas 设置 isAccessibilityElement 和 accessibilityTraits 属性的问题:
canvasView.isAccessibilityElement = YES;
canvasView.accessibilityTraits = UIAccessibilityTraitAllowsDirectInteraction;
关于ios - 启用 Voice Over 的手势识别器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39367650/
欢迎光临 OStack程序员社区-中国程序员成长平台 (https://ostack.cn/) | Powered by Discuz! X3.4 |