Disable Scroll on a UIWebView allowed?(允许在 UIWebView 上禁用滚动?)
问题描述
我必须在文章下方显示带有 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 上禁用滚动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:允许在 UIWebView 上禁用滚动?
基础教程推荐
- 如何从 logcat 中删除旧数据? 2022-01-01
- NSString intValue 不能用于检索电话号码 2022-01-01
- iOS4 创建后台定时器 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
- AdMob 广告未在模拟器中显示 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
