iOS with UIWebView loadhtmlstring after the picture and text offset, the picture is too large, more than the screen, the text is too small, or the picture is too small, the text is too large, in short, is uncoordinated.
Our demand is to let the size of the picture with the changes in the screen, is dynamic to adapt to the screen, then the text of the font is we can control, can be very small. To achieve this effect, we want to handle 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%, is based on the screen width adaptive; Let the picture of the high Atuo, automatically adapt. Text font size, you can go to change font-size:15px, here I use 15px. Change it according to your specific needs.
loadhtmlstring image and text offset resolution with UIWebView in iOS