我的webview应用程序不会向下滚动。我试过用这个代码:
webview.scrollView.scrollEnabled = true但不起作用。
我必须将我的webview应用程序放到一个滚动视图应用程序中,还是webview应用程序就足够了?我已经试过了但直到现在才起作用。
我在ViewController.swift中的全部代码是:
import UIKit
class ViewController: UIViewController {
@IBOutlet var webView: UIWebView!
override func viewDidLoad() {
super.viewDidLoad()
//creo una costante di tipo NSURL
let url = NSURL(string: "http://www.apple.com")
//creo una richiesta di accesso a quello specifico indirizzo
let request = NSURLRequest(URL: url!)
//abilito lo zoom nella webView
webView.scalesPageToFit = true
webView.scrollView.scrollEnabled = true
//carico la richiesta a quell'URL e aggiorna la WebView
webView.loadRequest(request)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}发布于 2015-08-14 10:03:04
只需在代码中添加这一行:
webView.userInteractionEnabled = true一切都会好起来的。
发布于 2015-08-15 07:25:12
对于webview视图的滚动,您应该检查以下三个步骤:
1) webview视图应该是:webView.userInteractionEnabled = true
2) webview视图应该是:webview.scrollView.scrollEnabled = true
3) webview视图内容应该比您的webview框架更多。
https://stackoverflow.com/questions/32007307
复制相似问题