从 TouchesMoved 获取子视图引用

Getting a subview Reference from TouchesMoved

我有一个 2d-Grid 子视图。当我沿着这些子视图拖动手指时,我想调用每个视图的离散方法,这样对于悬停在上方的每个视图,此方法都会被调用一次。注销 touches 参数的结果似乎只有一个视图是通过拖动引用的,即 touchesbegan 位于其之上的视图。如何根据坐标获取我的手指当前拖动位置的视图?

- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event 
{
    UITouch *touch = [[event allTouches] anyObject];
    CGPoint touchLocation = [touch locationInView:self.contentView];

    for (UIView *view in self.contentView.subviews)
    {
        if ([view isKindOfClass:[MyView class]] &&
            CGRectContainsPoint(view.frame, touchLocation))
        {

        }
    }
}

参考:iOS - Detecting touches in a UIView?