怎么把字体加粗
[cell.itemContentWebView loadHTMLString:[NSString stringWithFormat:@"<div style='font-family:-apple-system','HelveticaNeue-Bold; style='font-size:24px;'>%@",object.title] baseURL:nil];
Rafay for your question
- (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'"];
}
Just prefix a tag to your string before loading into the webView.
NSString *body = [plist objectForKey:@"foo"];
NSString *htmlString =
[NSString stringWithFormat:@"<font face='GothamRounded-Bold' size='3'>%@", body];
[webView loadHTMLString:htmlString baseURL:nil];
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.