Guest User

Untitled

a guest
Jan 9th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. override func viewDidLoad() {
  2. super.viewDidLoad()
  3.  
  4. let navBarHeight: CGFloat = self.navigationController?.navigationBar.frame.height ?? 0.0
  5.  
  6.  
  7. title = "Webview"
  8. view.backgroundColor = .white
  9.  
  10. let webView = UIWebView()
  11. webView.translatesAutoresizingMaskIntoConstraints = false
  12.  
  13. view.addSubview(webView)
  14.  
  15. webView.topAnchor.constraint(equalTo: self.view.topAnchor, constant: navBarHeight).isActive = true
  16. webView.leftAnchor.constraint(equalTo: self.view.leftAnchor).isActive = true
  17. webView.rightAnchor.constraint(equalTo: self.view.rightAnchor).isActive = true
  18. webView.bottomAnchor.constraint(equalTo: self.view.bottomAnchor).isActive = true
  19.  
  20. let request = URLRequest(url: URL(string: "https://apple.com")!)
  21. webView.loadRequest(request)
  22.  
  23. }
Add Comment
Please, Sign In to add comment