我必须在文章下方显示带有 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 上禁用滚动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!