ios - 启用语音后如何从自定义 View 上的点击位置获取 CGPoint?
<p><p>我正在将我的应用设置为与旁白功能兼容。我有一个图表,我可以单击 -accessibilitiHint()。我需要确认双击时的用户操作,甚至可以通过accessibilityActivate() 获得。触摸点需要在单击时检索。</p>
<p>现在有什么方法可以在我的 View 上执行单击时获取用户触摸点吗?</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>对于 Objective-C </p>
<p>第 1 步:将 TapeGesture 识别器添加到您的 View 中</p>
<pre><code>UITapGestureRecognizer *tapGesture = [ initWithTarget:self action:@selector(tapGestureHandler:)];
tapGesture.delegate = self;
;
</code></pre>
<p>第二步:实现手势委托(delegate)方法</p>
<pre><code>- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
{
return YES;
}
</code></pre>
<p>第 3 步:实现手势处理程序</p>
<pre><code>- (void)tapGestureHandler:(UITapGestureRecognizer *)gesture
{
CGPoint touchPoint = ;
}
</code></pre></p>
<p style="font-size: 20px;">关于ios - 启用语音后如何从自定义 View 上的点击位置获取 CGPoint?,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/44151511/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/44151511/
</a>
</p>
页:
[1]