UIPanGestureRecognizer *panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(pan:)];
[self addGestureRecognizer:panRecognizer];
- (void)pan:(UIPanGestureRecognizer *)gesture {
NSLog(@"%f", [gesture translationInView:self].x);
}
上述代码将记录当前pan手势的相对位置,但如何获取我所在视图的绝对位置?我只是想将UIImageView滑动到用户手指所在的位置。