我制作了一个webview应用程序但是,我不能拉动刷新。 我能怎么做? 这是我的代码。
override func viewDidLoad() {
super.viewDidLoad()
let url = URL(string: "http://www.vicco.com.tr/report/")
let request = URLRequest(url: url!)
viewTwo.loadRequest(request);
}
答案 0 :(得分:1)
Please try this for swift
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
let refreshControl = UIRefreshControl()
refreshControl.addTarget(self, action: #selector(refreshWebView), for: UIControlEvents.valueChanged)
webViewPDF.scrollView.addSubview(refreshControl)
}
func refreshWebView(sender: UIRefreshControl) {
print("refersh")
self.webViewPDF.loadRequest(URLRequest(url: URL(string: "https://google.com")!))
sender.endRefreshing()
}