允许在UIWebView上禁用滚动? [英] Disable Scroll on a UIWebView allowed?
问题描述
我必须在文章下面显示一篇带有 UITableView
的网页文章。
I have to show a web article with a UITableView
under the article.
我找到的唯一选项是在tableView标题中的 UIWebView
中显示文章。
The only option I found was to display the article in a UIWebView
in the tableView header.
为了做到这一点,我必须得到webView内容的高度,我必须禁用webView的滚动。
In order to do that I have to get the height of the webView content and I have to disable scrolling for the webView.
我找到了两个禁用滚动的解决方案:
I found two solutions to disable scrolling:
for (id subview in webView.subviews)
if ([[subview class] isSubclassOfClass: [UIScrollView class]])
((UIScrollView *)subview).scrollEnabled=NO;
或在JavaScript中:
or in JavaScript:
<script type="text/javascript">
touchMove = function(event) {
event.preventDefault();
}
我听说Apple禁止第一个解决方案,但我没有任何证明。
使用此解决方案会拒绝我的申请吗?如果是这样,我可以使用第二个解决方案而不被拒绝吗?
I heard that the first solution is forbidden by Apple but I don't have any proof of it. Will my application be rejected by using this solution? If so, can I use the second solution without being rejected?
推荐答案
从iOS5开始,我们可以直接访问滚动视图UIWebView的。
您可以禁用这样的滚动和反弹:
Starting with iOS5 we have direct access to the scrollview of the UIWebView.
You can disable scrolling and bounces like this:
webView.scrollView.scrollEnabled = NO;
webView.scrollView.bounces = NO;
这篇关于允许在UIWebView上禁用滚动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!