I'm struggling with formatting a short plain text string, which may include a weblink, in a UIWebView. When I use loadHTMLString, the font style and size appear incorrect. After searching extensively, I ended up embedding the text in a makeshift HTML document with CSS. Here's the code snippet:
NSString *myHtml = [NSString stringWithFormat:
@"<html><head>"
"<style type=\"text/css\">"
"body{"
"font-family: Helvetica;"
"font-size: 20px;"
"a {color: #FFF;}"
"},</style>"
"</head><body>%@</body></html>", myText];
[self.myWebView loadHTMLString:myHtml baseURL:nil];
Issue: I'm having difficulty changing the style of links within the text. I've tried a {color:#fff;}, *:link{color:#fff;} and other variations without success. The default link appearance remains unchanged, with no adjustments to color, size, or background.
Any suggestions on how to customize the appearance of links? Would implementing JavaScript be the only solution?