Need to Remove Whitescreen before loading webview in iOS, tried webview opaque. Even after adding Splash Screen & launch screen, I'm still getting the white splash before LOADING Webview URL.
import UIKit
import WebKit
class HomeViewController: UIViewController, WKUIDelegate {
var webView: WKWebView!
override func loadView() {
let webConfiguration = WKWebViewConfiguration()
webView = WKWebView(frame: .zero, configuration: webConfiguration)
webView.uiDelegate = self
view = webView
webView.isOpaque = false
}
override func viewDidLoad() {
super.viewDidLoad()
let webConfiguration = WKWebViewConfiguration()
webView = WKWebView(frame: .zero, configuration: webConfiguration)
webView.translatesAutoresizingMaskIntoConstraints = false
let myURL = URL(string:"https://google.com")
let myRequest = URLRequest(url: myURL!)
view.addSubview(webView)
webView.load(myRequest)
NSLayoutConstraint.activate([
webView.topAnchor.constraint(equalTo: view.topAnchor),
webView.bottomAnchor.constraint(equalTo: view.bottomAnchor),
webView.leftAnchor.constraint(equalTo: view.leftAnchor),
webView.rightAnchor.constraint(equalTo: view.rightAnchor)
])}
}
CodePudding user response:
have you tried to remove the background color of webView?
webView.backgroundColor = .clear
CodePudding user response:
have you tried
self.webView.scrollView.backgroundColor = .clear