gpt4 book ai didi

ios - webViewDidStartLoad 不工作

转载 作者:可可西里 更新时间:2023-11-01 00:09:09 27 4
gpt4 key购买 nike

webViewDidStartLoadwebViewDidFinishLoad 不工作。

我已经做了什么:

  1. webView.delegate = self;
  2. 添加了UIWebViewDelegate
  3. 将代码放在 viewDidAppear 中。

代码如下:

func webViewDidStartLoad(webView: UIWebView!) {
print("Webview started Loading")
}

func webViewDidFinishLoad(webView: UIWebView!) {
print("Webview did finish load")
}

最佳答案

检查这个工作正常的简单示例代码:

import UIKit

class ViewController: UIViewController, UIWebViewDelegate {

@IBOutlet weak var webView: UIWebView!

override func viewDidLoad() {
super.viewDidLoad()

let url = "http://apple.com"

let requestURL = NSURL(string:url)
let request = NSURLRequest(URL: requestURL!)
webView.delegate = self
webView.loadRequest(request)
}

func webViewDidStartLoad(webView: UIWebView) {
print("Webview started Loading")
}

func webViewDidFinishLoad(webView: UIWebView) {
print("Webview did finish load")
}
}

关于ios - webViewDidStartLoad 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34852267/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com