我的项目设计:UINavigationController ---> UITableViewController ---> UIViewController
我有一个 UISeachBar
在 navigationItem.titleView
我尝试使用 UITapGestureRecognizer
,它可以工作,但不如预期。仅当我触摸 UITableViewCell
时键盘才会关闭.
我要UITableView
回复 touchesBegan
这样我就可以让键盘在我触摸 UITableViewCell
时消失或者只是在 table 上滚动。
除此之外,我的UIViewController
包含 googlemap 的 View ,它确实响应 touchesBegan
但只有第一次触摸,之后,其他所有触摸都将被忽略。
任何人都可以帮忙吗?
太长了,没看:我想关闭 UITableView
上的虚拟键盘喜欢 safari 或 chrome:触摸开始时,而不是结束时
最佳答案
试试这个
[self.view endEditing:YES];
关于ios - 在 UITableView 和 GoogleMap 的 View 上开始触摸时关闭键盘,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20347284/