UIScrollView中的触摸事件发送到后台视图

时间:2011-01-12 21:53:43

标签: ipad uitableview uiscrollview touch

我有检测触摸的问题。

我用TableView放置了一个视图。我选择一行,使用ScrollView添加新视图。 ScrollView放在TableView上,但是是一个带有clearColor背景的ScrollView,可以看到后面的TableView。我需要触摸ScrollView并发送触摸以检测为用户选择的行。

我可以在ScrollView whit touchBegan中检测到触摸,并且我将触摸发送到后面的tableView视图,但是didSelectRow没有检测到触摸,只检测触摸,如果我放入tableView视图中的其他touchBegan,但是我需要发送触摸以选择所选行。

非常感谢!!

         First View
-----------------------------
-         -                 - 
-         -                 - 
-    T    -                 - 
-    A    -                 - 
-    B    -                 - 
-    L    -                 - 
-    E    -                 - 
-    V    -                 - 
-    I    -                 - 
-    E    -                 - 
-    W    -                 - 
-         -                 - 
-         -                 - 
-----------------------------


        Second View  --> ##### is the ScrollView area on tableView FirstView
-----------------------------
-   -######                 - 
-   -######                 - 
-   -######                 - 
-   -######                 - 
-   -######                 - 
-   -######   SCROLL        - 
-   -######    VIEW         - 
-   -######                 - 
-   -######                 - 
-   -######                 - 
-   -######                 - 
-   -######                 - 
-   -######                 - 
-----------------------------

######我需要触摸这个位置,然后在后面的tableView中选择行。

1 个答案:

答案 0 :(得分:1)

当您确定需要在滚动视图的touchesBegan方法中传递触摸时,请调用

[self.nextResponder touchesBegan:touches withEvent:event];

将事件传递给链,而不是直接尝试调用父视图的touchesBegan方法。