Search code examples
iosios5hittestfirst-responder

hitTest fires when UIKeyboard is tapped


I'm trying to fix a bug that involves UIView hitTest:withEvent: being called on my view when the touches are on the UIKeyboard, but only after the app has been in the background.

It was occurring in my app with a complex view hierarchy so I reproduced it in an app with only 2 views:

  • 1 UIView 768x1024 (fullscreen)
  • 1 UITextView 200x200 in the upper half of the fullscreen view

The behavior is as follows:

  • Tapping the textview causes the fullscreen view's hitTest method to fire, the textfield becomes first responder, and then the keyboard appears all as expected. Tapping on keyboard keys works fine.
  • Now dismiss the keyboard.
  • Send the app to the background.
  • Then resume the app.
  • Make the textview first responder again. Here's the trouble, now when tapping keys on the keyboard the fullscreen view's hitTest method is firing.

I'm seeing this on an iOS 5 iPad 2. Only on device though, never in the simulator. Any idea why hitTesting could get messed up in this way? Thanks.


Solution

  • Got the same issue here. It does happen ONLY when I hit home and return to the app. Does not happen in the first fresh run.

    And it is related to iOS5 as well.