移动开发

IOS 屏幕手指滑动点追踪

2016-12-21  本文已影响183人  JakieZhang

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent*)event {

UITouch*pTouch = touches.anyObject;

//self.view

CGPointposition = [pTouchlocationInView:self.view];

//self.myView

CGPointposition2 = [pTouchlocationInView:self.myView];

NSLog(@"开始1 %@",NSStringFromCGPoint(position));

NSLog(@"开始2 %@",NSStringFromCGPoint(position2));

}

-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent*)event {

UITouch*pTouch = touches.anyObject;

CGPointposition = [pTouchlocationInView:self.view];

NSLog(@"移动%@",NSStringFromCGPoint(position));

}

-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent*)event {

UITouch*pTouch = touches.anyObject;

CGPointposition = [pTouchlocationInView:self.view];

NSLog(@"抬起%@",NSStringFromCGPoint(position));

}

上一篇下一篇

猜你喜欢

热点阅读