Programmatically resize / adjust dynamic html to fit UIWebView
The requirement is to fit an HTML to a UIWebView with fixed size(s) ie predefined width x height combinations, these sizes could be specified by the developer. About the HTML, it contains scripts that further load other html(s) having dynamic elements, the nature of which is not known at runtime as the dynamic html(s) basically are rich media ads (advertisements). What I have tried from among the several 100 solutions posted for similar questions on SO:
The issue: regardless of the above 3 changes applied together or as a combination fails to render the HTML properly inside the webview. Either the elements overflow or they shrink and as a result the display is never 'correct'. This leads me to believe that this is altogether not possible because
I've not posted the actual code of the approaches tried above as none have worked & I think that they won't cater to dynamic HTML(s). I am at a dead end and would appreciate if someone could confirm my beliefs and validate them or point me towards a solution. If such a solution is said to not be possible at an app level (in the UIWebView), then maybe I could convince the html providers to deliver size based HTMLs instead. Any help is appreciated.
- (void)webViewDidFinishLoad:(UIWebView *)webView {
CGRect newBounds = webView.bounds;
newBounds.size.height = webView.scrollView.contentSize.height;
webView.bounds = newBounds;
}
(新泽西州)
链接地址: http://www.djcxy.com/p/77426.html