简体   繁体   中英

How can I convert the font-size in UIlabel to the font-size in UIwebView

I have a NSString with font-size 16 in UIlabel . And I want to show this NSString in UIWebView using syntax like font-size = '?' in html. And I want to the font-size in the UIWebView is corresponding to the font-size in UIlabel . How can I do this?

You can create a NSString which contains html code, then load UIWebview from the NSString with the method

- (void)loadHTMLString:(NSString *)string baseURL:(NSURL *)baseURL

In html you can set the font of text, which one you want.

您必须将字符串与html设置这样的字体大小连接

[yourWebView loadHTMLString:@"<p><font size="5">put your text here</font></p>" 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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM