Modifying the Current Selection

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];