iphone - touchesEnded :withEvent: not being called from my UIView, 位于 UITableView 之上

标签 iphone objective-c uitableview ios uiview

我的标题中有一个 UITableView 和一个 UISearchBar。当用户在 UISearchBar 中单击时,我创建一个 View (bg: black, alpha .65) 并将其放置在 UITableView 中的内容上。我想要的是当用户单击这个半透明的 UIView 时,从 UISearchBar 中退出第一响应者。我已经在我的 UIViewController(也是我的 UITableView 的 Controller )中实现了 touchesEnded:withEvent:,但是这个函数从未被调用过。我在这里遗漏了什么吗?

干杯,

罗布

最佳答案

你的 Controller 只会处理它自己的 View 的事件,这可能是 TableView 。如果你想在后面添加的 View 中处理触摸事件,你需要继承 UIView 并实现 touchesEnded:withEvent: 方法。

关于iphone - touchesEnded :withEvent: not being called from my UIView, 位于 UITableView 之上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4518414/

相关文章:

iphone - Facebook SDK : FBLoginView for publish stream

iphone - Interface Builder 中的 PNG 透明度

ios - 如何 UISearchcontroller customcell swift

ios - UITableView 内部不一致 : _visibleRows and _visibleCells must be of same length

ios - 如何在 View 加载时设置 UITableView 的滚动位置?

ios - 我想在我的 iOS 应用程序中支持本地化,但我希望我的键盘仅是英语。是否可以?

iphone - iOS中的多个按钮作为一个

objective-c - Objective C 架构问题

ios - 这是 UITableViewCellAccessoryDe​​tailDisclosureButton 的正常行为吗

ios - 解析器错误 Error Domain=NSXMLParserErrorDomain Code=4 "The operation couldn’ t be completed."