ios - 仅检测从右到左的旋转手势
<p><p>我能够检测到旋转手势,但我只需要检测从右到左的那个。</p>
<p>非常感谢任何帮助。</p>
<p>谢谢!</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>我假设您正在使用 UIRotationGestureRecognizer 来检测旋转。你应该有这样的东西:</p>
<pre><code>UIRotationGestureRecognizer *gestureRecognizer = [ initWithTarget:self action:@selector(gestureRecognizerAction:)];
;
</code></pre>
<p>和:</p>
<pre><code>- (void)gestureRecognizerAction:(UIRotationGestureRecognizer *)gestureRecognizer
{
if (gestureRecognizer.rotation > 0) {
//rotation in one side - lets say from left to right
} else {
//rotation in other side - lets say from right to left
}
}
</code></pre>
<p>通过这种方式,您将只能检测到从右到左的旋转。</p></p>
<p style="font-size: 20px;">关于ios - 仅检测从右到左的旋转手势,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/17733389/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/17733389/
</a>
</p>
页:
[1]