Aijaz Ali
Aijaz Ali

Reputation: 393

How to change the textcolor of UIWebnVIew iPhone

I am using webview to load the html string it loads the data but it does not change the text colour i am also changing colour but it does not get effect.

   NSString *myDescriptionHTML = [NSString stringWithFormat:@"<html> \n"
                               "<head> \n"
                               "<style type=\"text/css\"> \n"
                               "body {font-family: \"%@\"; font-size: %@; text-colour:red}\n"
                               "</style> \n"
                               "</head> \n"
                               "<body>%@</body> \n"
                               "</html>", @"helvetica", [NSNumber numberWithInt:18],  texts];

It shows default colour not the new one given

Upvotes: 0

Views: 32

Answers (1)

user2677746
user2677746

Reputation:

The issue is in your CSS code so simply replace

 "body {font-family: \"%@\"; font-size: %@; text-colour:red}\n"

with

 "body {font-family: \"%@\"; font-size: %@; color:red}\n"

Hope that will work

Upvotes: 3

Related Questions