ios - 启用 Voice Over 的手势识别器
<p><p>我开发了一个应用程序,允许用户在 Canvas 上绘制他的手指签名。
此功能是使用带有特定目标操作的 UIPanGestureRecognizer 在 UIView 中绘制一条线来实现的,但是当“Voice Over”处于事件状态时,手势识别器操作不再触发。</p>
<p>手势初始化代码</p>
<pre><code>UIPanGestureRecognizer *pan = [ initWithTarget:self action:@selector(pan:)];
pan.maximumNumberOfTouches = pan.minimumNumberOfTouches = 1;
;
</code></pre>
<p>手势 Action 代码</p>
<pre><code>- (void)pan:(UIPanGestureRecognizer *)pan {
CGPoint currentPoint = ;
CGPoint midPoint = midpoint(previousPoint, currentPoint);
if (pan.state == UIGestureRecognizerStateBegan)
{
;
}
else if (pan.state == UIGestureRecognizerStateChanged)
{
;
}
previousPoint = currentPoint;
;
}
</code></pre>
<p>有没有办法在“画外音”处于事件状态时使用手势在 View 中画线?</p>
<p>感谢和问候!</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>我解决了我为 UIViewCanvas 设置 isAccessibilityElement 和 accessibilityTraits 属性的问题:</p>
<pre><code>canvasView.isAccessibilityElement = YES;
canvasView.accessibilityTraits = UIAccessibilityTraitAllowsDirectInteraction;
</code></pre></p>
<p style="font-size: 20px;">关于ios - 启用 Voice Over 的手势识别器,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/39367650/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/39367650/
</a>
</p>
页:
[1]