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