Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- override func viewDidLoad() {
- super.viewDidLoad()
- let navBarHeight: CGFloat = self.navigationController?.navigationBar.frame.height ?? 0.0
- title = "Webview"
- view.backgroundColor = .white
- let webView = UIWebView()
- webView.translatesAutoresizingMaskIntoConstraints = false
- view.addSubview(webView)
- webView.topAnchor.constraint(equalTo: self.view.topAnchor, constant: navBarHeight).isActive = true
- webView.leftAnchor.constraint(equalTo: self.view.leftAnchor).isActive = true
- webView.rightAnchor.constraint(equalTo: self.view.rightAnchor).isActive = true
- webView.bottomAnchor.constraint(equalTo: self.view.bottomAnchor).isActive = true
- let request = URLRequest(url: URL(string: "https://apple.com")!)
- webView.loadRequest(request)
- }
Add Comment
Please, Sign In to add comment