Touch

it2022-05-08  8

///获取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:

转载于:https://www.cnblogs.com/zzzili/archive/2012/12/06/6662730.html

相关资源:百度touch.js API教程

最新回复(0)