How to change UIWebView or WKWebView default font

前端 未结 9 1268
陌清茗
陌清茗 2020-12-08 01:14

What font does UIWebView and WKWebView use by default? I would like to be able to change that. But I don\'t want to do it in the html string, inste

9条回答
  •  南方客
    南方客 (楼主)
    2020-12-08 01:50

    Just prefix a tag to your string before loading into the webView.

    NSString *body = [plist objectForKey:@"foo"];
    NSString *htmlString = 
        [NSString stringWithFormat:@"%@", body];
    [webView loadHTMLString:htmlString baseURL:nil];
    

提交回复
热议问题