Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import UIKit
- import WebKit
- class WebShadVC: UIViewController {
- let wv: WKWebView = WKWebView()
- override func viewDidAppear(_ animated: Bool) {
- super.viewDidAppear(animated)
- wv.translatesAutoresizingMaskIntoConstraints = false
- view.addSubview(wv)
- let g = view.safeAreaLayoutGuide
- NSLayoutConstraint.activate([
- wv.topAnchor.constraint(equalTo: g.topAnchor, constant: 20.0),
- wv.leadingAnchor.constraint(equalTo: g.leadingAnchor, constant: 20.0),
- wv.trailingAnchor.constraint(equalTo: g.trailingAnchor, constant: -20.0),
- wv.bottomAnchor.constraint(equalTo: g.bottomAnchor, constant: -20.0),
- ])
- var titleColor: String?
- let htmlstr: String = "<p>geschieht</p>"
- let str = "<!DOCTYPE html> <html> <head> <link href='https://fonts.googleapis.com/css?family=Fira Sans Condensed' rel='stylesheet'> <style> body {font-family: 'Fira Sans Condensed';} .image {width: 100%; height: auto;} .bg-white { background: rgba(255, 255, 255, .7); border-radius:40px; padding: 20px; }html { padding: 10px;} h2 {\(titleColor ?? "font-size:40pt; color:#000000;")} p{ font-size:26pt; {font-family: 'Fira Sans', sans-serif;}.bold{font-weight:bold;}.italic{font-style: italic;}.oblique{font-style: oblique;}} strong{font-size:30pt} </style> </head> <body><div class='bg-white'>\(htmlstr) </div> </body> </html>"
- wv.loadHTMLString(str, baseURL: nil)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement