Browse Source

fix : 重播是图标没变

huzhiqiang 3 years ago
parent
commit
6c28f72f64

+ 3 - 3
BFFramework/Classes/Stuckpoint/Controller/PQStuckPointMusicContentController.swift

@@ -158,15 +158,15 @@ class PQStuckPointMusicContentController: PQBaseViewController {
     func updateCurrentPlayMusic(isPlaying: Bool, isClearCurrentMusic: Bool) {
         if lastIndexPath != nil, itemList.count > (lastIndexPath?.item ?? 0) {
             (itemList[lastIndexPath?.item ?? 0] as? PQVoiceModel)?.isPlaying = isPlaying
-            collectionView.reloadData()
+            collectionView.reloadItems(at: [lastIndexPath!])
         }
         if isClearCurrentMusic {
             if lastIndexPath != nil, itemList.count > (lastIndexPath?.item ?? 0) {
                 (itemList[lastIndexPath?.item ?? 0] as? PQVoiceModel)?.isSelected = false
                 (itemList[lastIndexPath?.item ?? 0] as? PQVoiceModel)?.isPlaying = false
+                collectionView.reloadItems(at: [lastIndexPath!])
             }
             lastIndexPath = nil
-            collectionView.reloadData()
         }
     }
 }
@@ -258,7 +258,7 @@ extension PQStuckPointMusicContentController: UICollectionViewDelegate, UICollec
             } else if contentType != .catagery {
                 (itemList[indexPath.item] as? PQVoiceModel)?.isPlaying = !((itemList[indexPath.item] as? PQVoiceModel)?.isPlaying ?? false)
                 (itemList[indexPath.item] as? PQVoiceModel)?.isSelected = true
-                collectionView.reloadData()
+                collectionView.reloadItems(at: [indexPath])
             }
         }
         if contentType == .catagery {

+ 6 - 3
BFFramework/Classes/Stuckpoint/View/PQStuckPointMusicContentCell.swift

@@ -125,10 +125,13 @@ class PQStuckPointMusicContentCell: UICollectionViewCell {
                 imageMaskView.isHidden = false
                 playImageView.isHidden = false
                 if (bgmData as? PQVoiceModel)?.isPlaying ?? false {
-                    playImageView.image = UIImage().BF_Image(named: "loading")
-                    startLoadingAnimation()
+                    if playImageView.image == nil ||  playImageView.image == UIImage().BF_Image(named: "stuckPoint_music_pause"){
+                        playImageView.image = UIImage().BF_Image(named: "loading")
+                        startLoadingAnimation()
+                    }else {
+                        playImageView.kf.setImage(with: URL(fileURLWithPath: Bundle().BF_mainbundle().path(forResource: "stuckPoint_music_playing", ofType: ".gif")!))
+                    }
 
-//                    playImageView.kf.setImage(with: URL(fileURLWithPath: Bundle().BF_mainbundle().path(forResource: "stuckPoint_music_playing", ofType: ".gif")!))
                     musicNameLab.move()
                 } else {
                     playImageView.image = UIImage().BF_Image(named: "stuckPoint_music_pause")