Ryan Brubaker
Ryan Brubaker

Reputation: 177

UIEvent passed into -[UIView hitTest:]

I'm overriding the -hitTest: method in a custom UIWebView subclass. The UIEvent that gets passed to this method always has an empty set of touches ( [[event allTouches] count] is == 0 ). Shouldn't there be touch information in the UIEvent object or is this a bug?

I've tried other UIVIew types (e.g. UIView, UIWindow) and see the same behavior so it's not restricted to UIWebView. This is for any version of the 2.* SDK.

Thanks.

Upvotes: 5

Views: 6753

Answers (2)

Ryan Brubaker
Ryan Brubaker

Reputation: 177

I was never able to figure out why the UIEvent passed into hitTest:withEvent had an empty set of touches.

I did come up with a solution to my problem though. I was only concerned with single-taps so I'm not sure how applicable it might be to anyone else's situation. See my blog post at: http://ryan-brubaker.blogspot.com/2009/01/iphone-sdk-uiwebview.html

Upvotes: 2

Cory Foy
Cory Foy

Reputation: 7212

Looks like you have to implement a transparent view on top of it, and then delegate all events down to the UIWebView:

has a bunch more information about how they got it to work.

Upvotes: 0

Related Questions