Просмотр исходного кода

modify: 相册添加icloud云图标

Melody 5 лет назад
Родитель
Сommit
607766f389

+ 15 - 1
SuperShow/Tool/WSSImagePickerController.swift

@@ -120,7 +120,21 @@ extension WSSImagePickerController {
         }
 
         assetCellDidLayoutSubviewsBlock = { [weak self] cell, _, _, _, bottomView, _, videoImageView in
+            guard let cellModel = cell?.model else { return }
+            let isImageType = cellModel.type.rawValue == 0
             videoImageView?.isHidden = true
+            bottomView?.isHidden = isImageType // 图片默认隐藏,视频的话默认显示
+
+            if let phAsset = cellModel.asset {
+                let resourceArray = PHAssetResource.assetResources(for: phAsset)
+                if let hasLocalResource = resourceArray.first?.value(forKey: "locallyAvailable") as? Bool {
+                    if !hasLocalResource {
+                        videoImageView?.image = R.image.template_album_icloud()
+                        videoImageView?.isHidden = false
+                        bottomView?.isHidden = false /// PS: 无论是图片还是视频,都需要显示,而bottomView 也需要显示
+                    }
+                }
+            }
             bottomView?.backgroundColor = UIColor.clear
             bottomView?.layer.contents = R.image.video_shadow()?.cgImage
 
@@ -266,7 +280,7 @@ extension WSSImagePickerController {
         tipLabel.backgroundColor = OJSColor(hexRGBValue: 0x292935)
         tipLabel.text = "请选择有人物动作的视频"
         tipLabel.textAlignment = .center
-        tipLabel.textColor = OJSColor(hexRGBValue: 0xcccccc)
+        tipLabel.textColor = OJSColor(hexRGBValue: 0xCCCCCC)
         tipLabel.font = OJAFont.font14
         tipLabel.tag = 2001
         return tipLabel

+ 6 - 3
SuperShow/UI/ResourcePicker/WSSResourcePickerController.swift

@@ -995,15 +995,18 @@ extension WSSResourcePickerController: UICollectionViewDataSource, UICollectionV
 
             weak var weakCell = cell
             cell.assetCellDidLayoutSubviewsBlock = { cell, imageView, _, _, bottomView, _, videoImageView in
-
+                guard let cellModel = cell?.model else { return }
+                let isImageType = cellModel.type.rawValue == 0
                 videoImageView?.isHidden = true
-                if let phAsset = indexModel?.asset {
+                bottomView?.isHidden = isImageType // 图片默认隐藏,视频的话默认显示
+
+                if let phAsset = cellModel.asset {
                     let resourceArray = PHAssetResource.assetResources(for: phAsset)
                     if let hasLocalResource = resourceArray.first?.value(forKey: "locallyAvailable") as? Bool {
                         if !hasLocalResource {
                             videoImageView?.image = R.image.template_album_icloud()
                             videoImageView?.isHidden = false
-                            //TODO - 图片并没有显示bottomView
+                            bottomView?.isHidden = false /// PS: 无论是图片还是视频,都需要显示,而bottomView 也需要显示
                         }
                     }
                 }