我正在使用UIRotationGestureRecognizer
,并且在目标方法中有以下代码:
if (gestureRecognizer.state == UIGestureRecognizerStateBegan) {
UIView *piece = gestureRecognizer.view;
CGPoint locationInView = [gestureRecognizer locationInView:piece];
CGPoint locationInSuperview = [gestureRecognizer locationInView:piece.superview];
piece.layer.anchorPoint = CGPointMake(locationInView.x / piece.bounds.size.width, locationInView.y / piece.bounds.size.height);
piece.center = locationInSuperview;
}
但是我不太清楚locationInView:
返回值表示哪个值,因为应该有两个手指触摸屏幕。
答案 0 :(得分:2)
locationInView:
方法返回两个触摸的中心点。如果您想知道两个单独触摸的位置,请使用locationOfTouch:inView:
。
答案 1 :(得分:1)