gpt4 book ai didi

html - 如何修复 webview 中调整视频 HTML 的大小?

转载 作者:行者123 更新时间:2023-11-28 06:23:03 27 4
gpt4 key购买 nike

如何使用 HTML 代码在 webview 中修复此视频,我使用 WordPress 应用

import UIKit

class ShowAricleVCViewController: UIViewController {

@IBOutlet weak var webview: UIWebView!

var Content : String!



override func viewDidLoad() {


}


override func viewWillAppear(_ animated: Bool) {

let TheHtmlAfter = HTMLImageCorrector(HTMLString: Content)

webview.loadHTMLString(TheHtmlAfter, baseURL: nil)

}



func HTMLImageCorrector(HTMLString: String) -> String {
let htmlString: String = "<html> <meta name='viewport' content='width=device-width, initial-scale=1'><head><style>body { background: white } p { color: #555555; font-family: 'Avenir-Book'; font-size: 14px } img { border-radius: 8px; max-width: 100%; max-height: 220px; display: block; margin-left: auto; margin-right: auto;} </style></head><body><img align=\"middle\" > <p>\(HTMLString)<p></body></html>"
return htmlString
}

这段代码只是固定图片和字体和背景我需要修复视频系统

   func HTMLImageCorrector(HTMLString: String) -> String {
let htmlString: String = "<html> <meta name='viewport' content='width=device-width, initial-scale=1'><head><style>body { background: white } p { color: #555555; font-family: 'Avenir-Book'; font-size: 14px } img { border-radius: 8px; max-width: 100%; max-height: 220px; display: block; margin-left: auto; margin-right: auto;} </style></head><body><img align=\"middle\" > <p>\(HTMLString)<p></body></html>"
return htmlString
}[enter image description here][1]

最佳答案

func HTMLImageCorrector(HTMLString: String) -> String {
let htmlString: String = "<html> <meta name='viewport' content='width=device-width, initial-scale=1'><head><style>body { background: white } p { color: #555555; font-family: 'Avenir-Book'; font-size: 14px } img { border-radius: 8px; max-width: 100%; max-height: 220px; display: block; margin-left: auto; margin-right: auto;} iframe { border-radius: 8px; max-width: 100%; max-height: 220px; display: block; margin-left: auto; margin-right: auto;} </style></head><body><img align=\"middle\" > <p><div dir='rtl'><center>\(HTMLString)</center></div><p></body></html>"
return htmlString
}

关于html - 如何修复 webview 中调整视频 HTML 的大小?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42787603/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com