ios - WebView无法从网页顶部滚动到底部

标签 ios swift scroll webview

我已将网页加载到 xcode WebView。但仅加载页面的上半部分。我无法向下滚动到页面底部。 pdf 的事实也是如此。只能滚动上面 2 页。我能做什么?这是我的代码。 提前致谢。

import UIKit

class ViewController: UIViewController {

@IBOutlet var webView: UIWebView!
override func viewDidLoad() {
    super.viewDidLoad()

    var URL = NSURL(string: "http://www.archetapp.com")
    webView.loadRequest(NSURLRequest(URL: URL!))

  }

  override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
  }
}

//pdf

import UIKit

class ViewController: UIViewController {

  @IBOutlet var webViews: UIWebView!

  var path = ""

 override func viewDidLoad() {
    super.viewDidLoad()

    path  = NSBundle.mainBundle().pathForResource("ibook", ofType: "pdf")!
    let url = NSURL.fileURLWithPath(path)
    webViews.scalesPageToFit = true
    webViews.scrollView.scrollEnabled = true
    webViews.userInteractionEnabled = true
    self.webViews.loadRequest(NSURLRequest(URL: url!))        
  }

  override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()

  }

}

最佳答案

我今天遇到了同样的问题,至少在我的情况下,这是由于在 WebView 属性中选中“缩放页面以适合”选项引起的。我假设卡洛斯关于缩放比例的回复无论如何都会修复它,但我不需要首先启用该选项,所以这是我的简单修复。

关于ios - WebView无法从网页顶部滚动到底部,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36207048/

相关文章:

ios - Firebase简单登录错误 "__NSPlaceholderDictionary initWithObjects:forKeys:count:"

swift - 将泛型添加到递归枚举时: compiler can not infer type

swift - SpriteKit : White Background As SKScene

asp.net IFrame 滚动条推到顶部。 .

java - 如何滚动到 JTable 中的最后一行

Jquery 工具 触摸水平仅禁用垂直触摸

ios - Swift - 查看层次结构

iphone - 权限被拒绝-iPhone Froze-iOS6

ios - 如何去除 UIPopoverController 中的 "fuzzy"阴影

Swift CSVImporter 无法读取 CSV 文件