【发布时间】:2018-01-05 06:01:13
【问题描述】:
我正在使用 Xcode 8.3.3 和 Swift 3 为使用 Cocoa 的 iMac 开发应用程序。我的目标是使用VCgoToWebPage 并向用户显示网页。我的程序多次调用此函数,但我看到的唯一网页是最后一个调用的网页。如何在该函数内部实现窗口刷新并等待网页完全渲染?
func VCgoToWebPage(theWebPage : String) {
let url = URL(string: theWebPage)!
let request = URLRequest(url: url)
webView.load(request)
/*The modal box allows the web pages to be seen. Without it, after a series of calls to VCgoToWebPage only the last page called is displayed. The modal box code is just for debugging and will be removed. */
let alert = NSAlert()
alert.messageText="calling EDGAR page"
alert.informativeText=theWebPage
alert.addButton(withTitle: "OK")
alert.runModal()
}
【问题讨论】:
标签: swift macos cocoa wkwebview