@IBAction func btnClick(_ sender: Any) {
self.performSegue(withIdentifier: "Identify specified by segue", sender: nil)
}
@IBOutlet weak var webPage: WKWebView!
override func viewDidLoad() {
super.viewDidLoad()
let homeUrl="https://google.com"
openUrl(urlString: homeUrl)
webPage.navigationDelegate = self
}
//Open Web View with the URL specified by the string
func openUrl(urlString: String) {
let url = URL(string: urlString)
let request = NSURLRequest(url: url!)
webPage.load(request as URLRequest)
}
@IBAction func goBack(_ sender: Any) {
self.dismiss(animated: true, completion: nil)
}
Set the following two of Segue
In the case of iPhone X etc., if only the above is done, the time on the screen etc. will be left out, so this is also necessary
The following settings are required to obtain the motion sensor of the device
var rcvURL=""
override func viewDidLoad() {
super.viewDidLoad()
webView.uiDelegate = self //I need this
webView.navigationDelegate = self
openUrl(urlString: rcvURL)
}
A white box of Media Player and a controller for video playback appear on the screen. Checking all the properties (?) Of the Web View solved this problem. Cause unknown.
reference https://fuuno.net/swift/bo_bi_1/bo_bi_1.html https://yuu.1000quu.com/how_to_use_segue https://qiita.com/zlia_7/items/e99b77372d8c0f38d98b https://qiita.com/Sab_swiftlin/items/4f184c66477e291d4a0a
Recommended Posts