在子视图上获取 touchesBegan (UIWebView) [英] Get touchesBegan on a subview (UIWebView)
本文介绍了在子视图上获取 touchesBegan (UIWebView)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个 UIWebView,它被添加为 UIview 中的子视图,我想检测何时触摸此 UIWebView,但 touchesBegan 不起作用.
I've an UIWebView which is added as a subview in a UIview and I would like to detect when this UIWebView is touched but touchesBegan just don't work.
有什么想法吗?
推荐答案
- 在您的代码中对 UIWebView 进行子类化,然后在您的类中实现 touchesBegan.
- 将子类化的 webview 添加为 UIView 的子视图.
在子类的 UIWebView 中调用 super
- Subclass UIWebView in your code and then implement touchesBegan in your class.
- Add the subclassed webview as a subview of your UIView.
Call super in the subclassed UIWebView
- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
[super touchesBegan: touches withEvent: event];
}
这篇关于在子视图上获取 touchesBegan (UIWebView)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文