新建一个uiView 设置类名
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{
//NSLog(@"%s",__func__);
// 获取当前触摸点的UITouch对象
UITouch *touch = [touches anyObject];
//获取 当前触摸的位置
CGPoint current = [touch locationInView:touch.view];
//获取 触摸前的位置
CGPoint previous = [touch previousLocationInView:touch.view];
NSLog(@"触摸前的点: %@ 当前触摸点:%@",NSStringFromCGPoint(previous), NSStringFromCGPoint(current));
// 改变位置
CGPoint center = self.center;
center.x += current.x - previous.x;
center.y += current.y - previous.y;
self.center = center;
}