3

I have a subclass of UIScrollView, and override all 4 Touches functions for it. In those Touches functions, [[self nextResponder] Touches...] and [super Touches...] are used to pass the touches events.

Also I have a view controller in which I override all 4 Touches functions too. In the Controller, I set the self.view as: self.view = subclass of UIScrollview;

Before iOS 5, when there are touches move on the scrollview, the view controller's touch functions can receive all touch begin/move/end/cancel calls. But in iOS 5, they can't, only one touchesBegan and one touchesMove are received.

From the log of the code, touch functions in the UIScrollView's subclass are always called.

Also, If I set the subclass.enableUserInteraction=NO, the touches function in view controller will be called well. But I need the scrollview to have interaction with user, so I can't set it to no.

Is there anything different I missed in iOS 5? Thank you in advance.

4

2 回答 2

5

有一个非常简单的解决方法:)

代替:

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

利用:

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

也适用于 touchesBegan 和 touchesEnded。

而已!问题消失了!现在触摸事件被传递给下一个响应者:)

于 2012-09-11T10:06:48.273 回答
1

看起来像一个 iOS 5 错误。请参阅此 SO 帖子:

touchesMoved 没有在 iOS5 中为 iPhone 触发 UIScrollView

“正如之前提到的,我向 Apple 记录了一个缺陷,他们终于回复了我。我引用:'经过进一步调查,已确定这是一个已知问题,目前正在由工程部门调查。”。他们给出了原始错误 ID #10213937。他们感谢提交错误,但不提供任何解决方法。'"

不幸的是,仍然不确定如何解决 iOS 5。

于 2011-12-31T07:30:49.037 回答