点击topView时如何检测bottomView的触摸位置

时间:2018-03-21 20:08:32

标签: ios swift uiview uigesturerecognizer touches

我将四个UIViews(topViews)添加为mainView的子视图。我想创建一个从topViews到endposition的bezierPath。为此,我需要获取topView相对于bottomView的位置。

我希望bottomView不要检测任何触摸,我只希望topViews获得触摸,但作为回报,给出了关于bottomView的位置。

这怎么可能?我目前正在使用touchesBegan,这只是给我整个底视图的位置。

1 个答案:

答案 0 :(得分:0)

您可以使用topView.convert(point, to: bottomView)方法将从topView坐标系检测到的点转换为bottomView坐标系。