WebView when loading HTML code, use WebView's own scalespagetofit
Can solve the problem that the picture brings more than the screen, but the problem is that the text becomes smaller, how to make the edge of the picture smaller, and the text or the original HTML size?
Just add a section of code to OK.
[Self.webview loadhtmlstring:[nsstring stringwithformat:@ "<! DOCTYPE html>
}
Add <! behind the loadhtmlstring. DOCTYPE html>
The main is img{width:%.fpx!important; height:%.fpx!important; margin:0! Important;padding:0! Important;left:0! important;} table{width:%.fpx!important; margin:0! Important;padding:0! Important;left:0! Important;right:0! important;}
img{width:%.fpx!important; height:%.fpx!important; margin:0! Important;padding:0! Important;left:0! important;} is to set the width height of the image to cover the style in the IMG tag and set its width height.
and table{width:%.fpx!important; margin:0! Important;padding:0! Important;left:0! Important;right:0! important;} is to set the width of the form to fit the phone screen, the height is not set.
Loading HTML images, form hyper-screen problems with WebView