Advertisement
Don_Mag

Untitled

Aug 10th, 2023
1,454
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Swift 1.38 KB | None | 0 0
  1. import UIKit
  2. import WebKit
  3.  
  4. class WebShadVC: UIViewController {
  5.    
  6.     let wv: WKWebView = WKWebView()
  7.  
  8.     override func viewDidAppear(_ animated: Bool) {
  9.         super.viewDidAppear(animated)
  10.  
  11.         wv.translatesAutoresizingMaskIntoConstraints = false
  12.         view.addSubview(wv)
  13.        
  14.         let g = view.safeAreaLayoutGuide
  15.         NSLayoutConstraint.activate([
  16.             wv.topAnchor.constraint(equalTo: g.topAnchor, constant: 20.0),
  17.             wv.leadingAnchor.constraint(equalTo: g.leadingAnchor, constant: 20.0),
  18.             wv.trailingAnchor.constraint(equalTo: g.trailingAnchor, constant: -20.0),
  19.             wv.bottomAnchor.constraint(equalTo: g.bottomAnchor, constant: -20.0),
  20.         ])
  21.        
  22.         var titleColor: String?
  23.  
  24.         let htmlstr: String = "<p>geschieht</p>"
  25.  
  26.         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>"
  27.        
  28.         wv.loadHTMLString(str, baseURL: nil)
  29.        
  30.     }
  31.  
  32. }
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement