简体   繁体   English

根据内容动态更改UIWebview的大小

[英]Dynamically change size of UIWebview based on content

I am presenting blog posts in a UIWebview. 我在UIWebview中展示博客文章。 How can I dynamically change the Webview to properly fit the content? 如何动态更改Webview以适合内容? I would like the height of the Webview to scale so that there is no need to scroll within the Webview. 我希望Webview的高度能够缩放,以便不需要在Webview中滚动。

Thanks! 谢谢!

You could wait until the web view calls the delegate to say that the load is complete, then take the content size and update the frame. 您可以等到Web视图调用委托说加载已完成,然后获取内容大小并更新框架。

Or you could use KVO to observe the content size and each time it updates you can update the frame. 或者,您可以使用KVO来观察内容大小,并且每次更新时都可以更新框架。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM