如何将字体设置为粗体
[cell.itemContentWebView loadHTMLString:[NSString stringWithFormat:@"<div style='font-family:-apple-system','HelveticaNeue-Bold; style='font-size:24px;'>%@",object.title] baseURL:nil];
最佳答案
拉斐回答你的问题
- (void)webViewDidFinishLoad:(UIWebView *)webView
{
//Font size
int fontSize = 80;
NSString *jsString = [[NSString alloc] initWithFormat:@"document.getElementsByTagName('body')[0].style.webkitTextSizeAdjust= '%d%%'", fontSize];
[webview stringByEvaluatingJavaScriptFromString:jsString];
//Font Family Style - Bold
NSString *jsWebViewFontFamilyString = [[NSString alloc] initWithFormat:@"document.getElementsByTagName('body')[0].style.fontFamily = 'HelveticaNeue-Bold'"];
[webview stringByEvaluatingJavaScriptFromString:jsWebViewFontFamilyString];
//Font Color or web view text color
[webview stringByEvaluatingJavaScriptFromString:@"document.getElementsByTagName('body')[0].style.color = 'Green'"];
}
关于html - 在iOS中使UIWebview的字体加粗,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33417158/