我在一个按钮上有一个Touch Drag Outside事件,我想在用户停止拖动并再次抬起屏幕的手指时检测并运行一个方法。我找不到与按钮中匹配的事件,而touchesEnded也无效。 怎么办?
答案 0 :(得分:0)
您应该使用touchesCancelled:withEvent:
答案 1 :(得分:0)
You can use "PangestureRecognizer" in this case and can determine the states of gestures
if (gestureRecognizer.state == UIGestureRecognizerStateBegan)
{
//do something
}
else if (gestureRecognizer.state == UIGestureRecognizerStateChanged)
{
//do something
}
else if (gestureRecognizer.state == UIGestureRecognizerStateEnded)
{
//do something
}