///获取touch位置 CGPoint touchPoint=[touch locationInView:self.view]; NSString *str=[NSString stringWithFormat:@"%f",touchPoint.x]; myLabel.text =str; // handle new touches - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { myLabel.text =@"touch"; [self processTouch:[touches anyObject]]; } // end method touchesBegan:withEvent: -(void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event //当触摸序列被诸如电话呼入这样的系统事件所取消时,发送touchesCancelled:withEvent:消息。 { myLabel.text=@"cancelles"; } -(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { myLabel.text=@"ended"; } // exactly the same as touchesBegan:withEvent: minus double-tapping - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { myLabel.text=@"move"; [self processTouch:[touches anyObject]]; } // end method touchesMoved:withEvent: