webView本身没有属性去修改webView里内容的字体大小颜色等等.但是可以通过修改html代码进而实现.
先上代码.
self.webView = [[UIWebView alloc]initWithFrame:self.view.bounds];
NSString *htmlString = [NSString stringWithFormat:@"<html> \n"
"<head> \n"
"<style type=\"text/css\"> \n"
"body {font-size: %d; font-family: \"%@\"; color: %@;}\n"
"</style> \n"
"</head> \n"
"<body>%@</body> \n"
"</html>", 12, @"FZLTXHK", @"rgb(255, 79, 121)", @"html"];
[self.webView loadHTMLString:htmlString baseURL:nil];
这里用字符串拼接的形式体现一下如何修改字体样式.如果webView里的内容是需要和客户端的某些字体样式保持一样.直接在最开始html里改好就行.