@@ -61,6 +61,8 @@ class ProductDetailDescriptionTableViewCell: UITableViewCell {
if str == "" {
str = "暂无数据"
}
+ str = "<head><style>img{width:\(kScreenWidth) !important;height:auto}</style></head>\(str)"
+ str = str.setHTMLImgStyle()
let htmlData = NSString(string: str).data(using: String.Encoding.unicode.rawValue)
let options = [NSAttributedString.DocumentReadingOptionKey.documentType:
NSAttributedString.DocumentType.html]
@@ -214,4 +214,10 @@ extension String {
attrstring.addAttribute(NSAttributedString.Key.foregroundColor, value:rangColor, range: theRange)
return attrstring
+
+ func setHTMLImgStyle() -> String {
+ let str = "<head><style>img{width:\(kScreenWidth) !important;height:auto}</style></head>\(self)"
+ return str
+ }