iOS with UIWebView loadhtmlstring after the picture and text offset, the picture is too large, over the screen, the text is too small. Or the picture is too small. The text is too big, in short it is uncoordinated.
Our need is to make the size of the picture change with the change of the screen. is to adapt to the screen dynamically. Then the font of the text is that we can control, can be large and small. To achieve this effect. We want to process the string before loading it with loadhtmlstring. How to deal with it? What's the principle?
Ways to handle Htmlstring:
NSString *htmls = [NSString stringWithFormat:@"
The principle of handling htmlstring:
The principle is to use a for loop, get all the pictures, for each picture is processed once, so that the width of the picture is 100%, according to the screen width adaptive. Let the picture of high Atuo, self-adaptation. The font size of the text, can go to change font-size:15px, here I use is 15px. According to their own detailed needs to change it.
Another blogger maintains an iOS development support group
loadhtmlstring image and text offset resolution with UIWebView in iOS