gpt4 book ai didi

swift - 函数声明中的下划线有什么作用?

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

<分区>

在下面的示例代码中,如果删除 webViewDidFinishLoad 声明中的下划线,它不会触发。下划线有什么作用?

import UIKit

class ViewController: UIViewController, UIWebViewDelegate {
@IBOutlet weak var playerWebView: UIWebView!

let youtubeUrl = URL(string: "https://youtube.com")

override func viewDidLoad() {
super.viewDidLoad()
playerWebView.delegate = self

let request = URLRequest(url: youtubeUrl!)

playerWebView.loadRequest(request)

print("viewDidLoad")
}

func webViewDidFinishLoad(_ playerWebView: UIWebView) {
print("webviewFinishedLoad")
}

override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}

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