There are a number of WebView editing methods that allow you to modify the current selection. For example, you can replace the current selection with plain text as follows:
[webView replaceSelectionWithText:@"SomeString"]; |
You can replace the current selection with a styled string as follows:
NSString *markupString = [NSString stringWithFormat: |
@"<span style='color: red; font-style: italic'>%@</span>", |
@"SomeString"]; |
[webView replaceSelectionWithMarkupString:markupString]; |
© 2003, 2008 Apple Inc. All Rights Reserved. (Last updated: 2008-10-15)