Browse Source

高度获取方法更换

Chris 5 years ago
parent
commit
5b394c1876

+ 2 - 16
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityVideoContent/View/CommunityVideoCoverCollectionCell.swift

@@ -777,22 +777,8 @@ class CommunityVideoCoverCollectionCell: UICollectionViewCell {
     func remakePlayViewConstrains() {
         let imgUrlStr: String = self.videoItemMdl?.img ?? ""
         
-        var leadingIdx = imgUrlStr.firstIndex(of: "*") ?? imgUrlStr.endIndex
-        leadingIdx = imgUrlStr.index(leadingIdx, offsetBy: 1)
-        let cutLeadUrl = imgUrlStr.suffix(from: leadingIdx)
-        
-        let trailingIdx = cutLeadUrl.firstIndex(of: ".") ?? cutLeadUrl.endIndex
-        let sizeStr = cutLeadUrl.prefix(upTo: trailingIdx)
-        
-        let arraySubstrings: [Substring] = sizeStr.split(separator: "_")
-        let widthStr  = arraySubstrings[0]
-        let heightStr = arraySubstrings[1]
-        
-        let doubleWidth = Double(widthStr)
-        let fWidth = CGFloat(doubleWidth ?? 0)
-        
-        let doubleHeight = Double(heightStr)
-        let fHeight = CGFloat(doubleHeight ?? 0)
+        let fWidth  = getImageWidth(imgStr: imgUrlStr)
+        let fHeight = getImageHeight(imgStr: imgUrlStr)
         
         let videoRatio : CGFloat = fHeight/fWidth
         let screenRatio: CGFloat = kScreenHeight/kScreenWidth