点击UIKeyboard时会触发hitTest [英] hitTest fires when UIKeyboard is tapped

查看:142
本文介绍了点击UIKeyboard时会触发hitTest的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试修复一个涉及UIView hitTest的错误:withEvent:当触摸在UIKeyboard上时,我的视图会被调用,但只有在应用程序处于后台后才会被调用。

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.

它发生在我的应用程序中,具有复杂的视图层次结构,所以我在一个只有2个视图的应用程序中重现它:

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(全屏)

  • 1全屏视图上半部分的UITextView 200x200

行为如下:


  • 点击文本视图会导致全屏视图的hitTest方法触发,文本字段成为第一响应者,并且然后键盘按预期显示。点击键盘键工作正常。

  • 现在关闭键盘。

  • 将应用程序发送到后台。

  • 然后恢复应用。

  • 再次使textview成为第一响应者。这是麻烦,现在当点击键盘上的键时,全屏视图的hitTest方法正在触发。

  • 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.

我在iOS上看到这个5 iPad 2.虽然只在设备上,但从不在模拟器中。知道为什么hitTesting会以这种方式搞砸了吗?谢谢。

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.

推荐答案

在这里遇到同样的问题。它确实发生在我回家并返回应用程序时。
在第一次新运行中不会发生。

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.

它也与iOS5有关。

这篇关于点击UIKeyboard时会触发hitTest的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆