iOS UIWebView with changing content size

孤者浪人 提交于 2019-12-05 18:32:52

you can set sizeToFit property and again set Frame of UIWebView in webViewDidFinishLoad

- (void)webViewDidFinishLoad:(UIWebView *)webView{
       [detailsWebView sizeToFit];
       [detailsWebView setFrame:CGRectMake(detailsWebView.frame.origin.x, detailsWebView.frame.origin.y, 300.0, detailsWebView.frame.size.height)];

}

Try setting the contenSize of its scrollview:

detailsWebView.scrollView.contentSize = CGSizeMake(detailsWebView.scrollView.contentSize.width,[[webView stringByEvaluatingJavaScriptFromString:@"document.body.offsetHeight"] floatValue]);

Use the UIWebView property scalesPageToFit = YES;

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!