I need to create a text editor (to align text, fonts, bold, italics, underline, etc.) for an iPhone application. I heard about storing data in HTML format and rendering it in a UIWebView. I want to allow the user to edit the data, and in my application I use TapDetectingWindow to detect strokes in the UIWebView (exactly the same detail here ).
- (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 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; }
But my application crashes with a message
tapDetectingWindow.viewToObserve = webView
and report
* -[UIWindow setViewToObserve:]: unrecognized selector sent to instance 0x4a26b90
Valli source share