手势(1)——touch的四个状态事件

//当我们的事件开始的时候调, 对于touch来说, 实际上当手指头放到屏幕上的时候,这个方法会被调用
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    NSLog(@"%s",__func__);
}

//当我们手指点击屏幕,并且没有抬起而滑动的时候, 这个方法被调用, 由此可知这个方法是连续被调用的。
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
    NSLog(@"%s",__func__);
}


//当我们的事件对束的时候调,对于touch来说, 实际上是当手指头离开屏幕的时候,这个方法会被调用
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
    NSLog(@"%s",__func__);
}

//当我们的事件被取消的时候, 比如说:手指点击在屏幕上, 突然来电话, 这个时候, 电话的优先级很高,
//所有的事件都应该被取消。 这个方法会被调用
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event
{
    NSLog(@"%s",__func__);
}

原文地址:https://www.cnblogs.com/wangdelong/p/3848134.html