UIWebView在scrollview中自动更改其高度

时间:2017-08-04 11:45:55

标签: ios xamarin.ios uiwebview

我正在尝试在Xamarin工作室的应用(评论API)中加入 disqus

我现在拥有scrollview,其中以URL编程方式添加了一些文字和图片。

我想在scrollview的底部添加UIWebView,但height的{​​{1}}可能不同,因此无法设置。

由于webviewwebview是否可以更改其大小 (我不希望content size内有scrollview,因此无法滚动scrollview

我不是在问这个解决方案,只是一些想法,如果可能的话。 感谢

1 个答案:

答案 0 :(得分:1)

If it's possible for you to use WKWebView instead of UIWebView, you can implement the same behavior (in terms of loading the URL and it's contents, etc.). WEKWebView exposes the scrollView property.

You can observe the "contentSize" property on that UIScrollView, and adjust your main scroll view's contentSize accordingly. Managing the contentOffset when this happens is a different thing all together.

Since your parent scrollView will always fully contain the webview, it won't scroll, leaving your user to be able to only scroll through the main view.