【发布时间】:2012-01-25 07:31:53
【问题描述】:
在我的应用程序中,我使用 TapDetectingWindow 来检测 UIWebView 上的触摸(与 http://mithin.in/2009/08/26/detecting-taps-and-events-on-uiwebview-the-right-way 中的详细信息完全相同)。 我按照建议在一个视图控制器中使用了它,并在头文件中引用了它,并在实现文件中使用了以下内容,例如
- (id)init {
self = [super init];
if (self) {
tapDetectingWindow = (TapDetectingWindow *)[[UIApplication sharedApplication].windows objectAtIndex:0]; //mWindow, variable reference to TapDetectingWindow
tapDetectingWindow.viewToObserve = webView;
tapDetectingWindow.controllerThatObserves = self;
webView = [[UIWebView alloc] init];
[webView setFrame:CGRectMake(0, 0, 340, 1900)];
[webView setTag:1];
[webView addSubview:keyboardText];
[webView setUserInteractionEnabled:NO];
[webView setDelegate:self];
[webView setOpaque:0.0];
[webView loadHTMLString:htmlString baseURL:NULL];
[self.view addSubview:webView];
keyboardText = [[UITextField alloc] init];
keyboardText.autocorrectionType = UITextAutocorrectionTypeNo;
[keyboardText setDelegate:self];
[self.view addSubview:keyboardText];
}
return self;
}
但我的应用程序崩溃了
"tapDetectingWindow.viewToObserve = webView "
带有报告 * -[UIWindow setViewToObserve:]: unrecognized selector sent to instance 0x4a26b90
谁能帮帮我...
【问题讨论】: