找到你要的答案

Q:UIWebView dont bounce and scroll

Q:UIWebView不弹跳和滚动

I m building a very simple ios native app with two view controllers referenced from a tab bar

both are webview, one is local html and other is loaded from url

for some reason the local webview does not allow scrolling and I cant figure out why.

I checked the settings in the storyboard and all the settings are the same

Use auto layout, user interaction enabled, mode aspect fit

I even tried to fix the issue by code , but adding this code to my view controller has not effect

webDisplay.scrollView.bounces = YES;
webDisplay.scrollView.scrollEnabled = YES;

Any ideas of what s wrong ?

我的建筑有两个视图控制器从一个标签栏引用了一个非常简单的iOS原生应用

都是Web视图,一是本地HTML和其他加载URL

由于某种原因,当地的WebView不允许滚动,我不知道为什么。

我检查了设置在故事情节和所有的设置都是一样的

使用自动布局,用户交互启用,模式方面适合

我甚至试图用代码来解决这个问题,但是把这个代码添加到我的视图控制器却没有效果

webDisplay.scrollView.bounces = YES;
webDisplay.scrollView.scrollEnabled = YES;

有什么想法吗?

answer1: 回答1:

yes you can try

webView.scrollView.scrollEnabled = NO;
webView.scrollView.bounces = NO;

f you want to check for being on iOS 4 or 5, you can test for UIWebView responding to the scrollView property getter:

if ([webView respondsToSelector:@selector(scrollView)]) {
    webView.scrollView.scrollEnabled = NO;
    webView.scrollView.bounces = NO;
} else {
    webView.scrollEnabled = NO;
    webView.bounces = NO;
}

是的你可以尝试

webView.scrollView.scrollEnabled = NO;
webView.scrollView.bounces = NO;

如果你想检查在iOS 4或5,你可以为UIWebView响应ScrollView属性getter试验:

if ([webView respondsToSelector:@selector(scrollView)]) {
    webView.scrollView.scrollEnabled = NO;
    webView.scrollView.bounces = NO;
} else {
    webView.scrollEnabled = NO;
    webView.bounces = NO;
}
answer2: 回答2:

The parent view was missing the user interaction enabled flag.

父视图缺少用户交互启用的标志。

answer3: 回答3:
for (id subview in webView.subviews)

if ([[subview class] isSubclassOfClass: [UIScrollView class]])

((UIScrollView *)subview).bounces = YES;

((UIScrollView *)subview). scrollEnabled = YES;
for (id subview in webView.subviews)

if ([[subview class] isSubclassOfClass: [UIScrollView class]])

((UIScrollView *)subview).bounces = YES;

((UIScrollView *)subview). scrollEnabled = YES;
ios  objective-c  iphone  uiwebview