是否可以在 SubView 中调用 TouchesBegan、touchesMoved 和 touchesEnded,而不是在 parentView 中?

Is it possible to call the TouchesBegan, touchesMoved and touchesEnded in SubView, and not in parentView?

我的问题是 touchesBegan、touchesMoved 和 touchesEnded 占据了焦点:

- (void)didSelectWithTableView:(UITableView *)tableView controller:(UIViewController *)controller
{
...
}

在表格视图中单击。所以 didSelectWithTableView 永远不会被调用...

是否可以有一个由 touchesBegan、touchesMoved 和 touchesEnded 而不是父视图处理的子视图(在弹出窗口中)?

只需调用方法的超级实现即可。连同您的覆盖代码。

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    [super touchesBegan:touches withEvent:event];
    ...
}

- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
    [super touchesMoved:touches withEvent:event];
    ...
}

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
    [super touchesEnded:touches withEvent:event];
    ...
}