使用Swift在Xcode中确定webView中的完成加载网站 [英] Determinate finish loading website in webView with Swift in Xcode

查看:242
本文介绍了使用Swift在Xcode中确定webView中的完成加载网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用swift在xcode中创建一个webapp,这是我当前的代码:

i'm trying to create a webapp with swift in xcode, this is my current code:

IBOutlet var webView: UIWebView!

    var theBool: Bool = false
    var myTimer = NSTimer()
    @IBOutlet var progressBar: UIProgressView!

override func viewDidLoad() {
   super.viewDidLoad()
   let url = NSURL(string: "http://stackoverflow.com")
   let request = NSURLRequest(URL: url)
   webView.loadRequest(request)
}

我有一个问题,我如何确定webView中页面的完成加载?

I've a question, How i can determinate the finish loading of the page in webView?

您是否知道包含WebView所有定义的文档?我的意思是..(开始/结束加载,当前网址,标题页等)?

Do you know a documentation that contains all the definitions of the WebView? I mean .. (start / end load, the current url, title page, etc ..)?

(对不起我的英文)。

推荐答案

通过 UIWebView 委托电话。

您需要将webViews 委托设置为当前控制器,并符合 UIWebViewDelegate 协议。当webView完成加载页面 func webViewDidFinishLoad(_ webView:UIWebView)将被调用。

You need to set your webViews delegate to the current controller, and conform to the UIWebViewDelegate protocol. When the webView finished loading the page func webViewDidFinishLoad(_ webView: UIWebView) will get called.

这篇关于使用Swift在Xcode中确定webView中的完成加载网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆