Я хочу изменить содержимое веб-представления, когда пользователь нажимает полужирный, курсив, подчеркивание, соответствующее значению изменения get в html string. Я реализую этот код. Он меняет вид, но как мы получаем значение изменения в html. Я новичок в iOS. Пожалуйста, помогите. Любая помощь будет оценена по достоинству.Как мы меняем контент WebView
- (BOOL)canPerformAction:(SEL)action withSender:(id)sender {
NSLog(@"canperfom Action:called");
NSLog(@"canPerformAction: called");
NSLog(@" action %@", NSStringFromSelector(action));
if (action == @selector(_showTextStyleOptions:)) {
NSLog(@"hello");
return NO;
}
if ([email protected](toggleBoldface:)) {
NSLog(@"bye");
return NO;
}
return [super canPerformAction:action withSender:sender];
}
- (void)webViewDidFinishLoad:(UIWebView *)theWebView
{
[theWebView stringByEvaluatingJavaScriptFromString:@"document.body.style.webkitTouchCallout='none'; document.body.style.KhtmlUserSelect='none'"];
NSString *js = @"var styleNode = document.createElement('style');\n"
"styleNode.type = 'text/css';\n"
"var styleText = document.createTextNode('a {-webkit-tap-highlight-color:rgba(0,0,0,0)}');\n"
"styleNode.appendChild(styleText);\n"
"document.getElementsByTagName('head')[0].appendChild(styleNode);\n";
[theWebView stringByEvaluatingJavaScriptFromString:js];
}
NSString * tempMailBodyString = [NSString stringWithFormat: @ "% @", myTextView.text]; NSString * htmlString = [Globals replaceRegex: @ "(? I) \ b ((?: [Az] [\ w -] +: (?:/{1,3} | [a-z0-9%]) | www \ d {0,3} [.] | [a-z0-9. \ -] + [.] [az] {2,4} /) (?: [^ \ s() <>] + | \ (([^ \ s() <>] + | (\ ([^ \ s() <>] + \))) \)) + (?: \ (([^ \ s()) < >] + | (\ ([^ \ s() <>] + \))) \) | [^ \ s`!() \ [\] {};: '\ "., <>?« »« »«]]): TempMailBodyString: [NSString stringWithFormat: @ "$ 1 $ 2"]];