Przeglądaj źródła

Merge branch 'feature/nanxinlin' into develop

南鑫林 5 lat temu
rodzic
commit
fca3e3e87e

+ 2 - 0
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ProductDetail/View/Cell/ProductDetailDescription/ProductDetailDescriptionTableViewCell.swift

@@ -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]

+ 6 - 0
RainbowPlanet/RainbowPlanet/Tools/Extension/Extension+String.swift

@@ -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
+
+    }
 }