我有一个带有一些UIViews的scrollView作为拖动的子视图。问题在于子视图相当小,并且在拖动它们时,您看不到它们,因为手指在路上。
拖动时如何使视图稍微向上偏移?
谢谢
if (recognizer.state == UIGestureRecognizerStateChanged)
{
CGPoint translation = [recognizer translationInView:self];
draggingView.center = CGPointMake(draggingView.center.x + translation.x,
draggingView.center.y + translation.y);
[recognizer setTranslation:CGPointZero inView:self];
}
最佳答案
尝试以下代码
CGPoint touchPoint = [recognizer locationInView:self];
尝试更改touchPoint
关于ios - UIPanGestureRecognizer:手指下方的偏移 View ,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/24989410/