南鑫林 5 роки тому
батько
коміт
84547d295b

+ 3 - 0
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityRecommendDetail/Controller/CommunityRecommendController.swift

@@ -374,6 +374,9 @@ extension CommunityRecommendController {
                 self?.nameButton.alpha = 0
                 self?.followButton.alpha = 0
             }else {
+                self?.avatarButton.alpha = 1
+                self?.nameButton.alpha = 1
+                self?.followButton.alpha = 1
                 self?.communityPostDetailTableViewHeaderView.frame = CGRect(x: 0, y: 0, width: kScreenWidth, height: kScreenWidth)
 
                 if !(self?.communityPostDetailModel?.imgs?.isEmpty ?? true) {

+ 5 - 1
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityRecommendDetail/View/CommunityTagCollectionCell.swift

@@ -10,10 +10,14 @@ import UIKit
 
 class CommunityTagCollectionCell: UICollectionViewCell {
     
+    deinit {
+        NXLLog("deinit")
+    }
+    
     class func cellWith(collectionView:UICollectionView,indexPath:IndexPath) -> CommunityTagCollectionCell {
         let ID = "CommunityTagCollectionCell"
         collectionView.register(CommunityTagCollectionCell.self, forCellWithReuseIdentifier: ID)
-        let cell : CommunityTagCollectionCell = collectionView.dequeueReusableCell(withReuseIdentifier: ID, for: indexPath) as! CommunityTagCollectionCell
+        let cell = collectionView.dequeueReusableCell(withReuseIdentifier: ID, for: indexPath) as! CommunityTagCollectionCell
         cell.indexPath = indexPath
         return cell
     }

+ 23 - 19
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityRecommendDetail/View/HTMLCell/CommunityRecommendDetailHTMLTableViewCell.swift

@@ -129,6 +129,8 @@ class CommunityRecommendDetailHTMLTableViewCell: UITableViewCell {
                 
             }
         }).disposed(by: disposeBag)
+        webView.scrollView.addObserver(self, forKeyPath: "contentSize", options: NSKeyValueObservingOptions.new, context: nil)
+
     }
     
     private lazy var titleLabel: UILabel = {
@@ -214,18 +216,8 @@ class CommunityRecommendDetailHTMLTableViewCell: UITableViewCell {
         return collectionView
     }()
     
-//    private lazy var collectionViewLayout: UICollectionViewLeftAlignedLayout = {
-//        let collectionViewLayout = UICollectionViewLeftAlignedLayout.init()
-//        collectionViewLayout.minimumLineSpacing = 10
-//        collectionViewLayout.minimumInteritemSpacing =  10
-//        collectionViewLayout.scrollDirection = UICollectionView.ScrollDirection.vertical
-//        collectionViewLayout.estimatedItemSize = CGSize(width: ((kScreenWidth - 28) - 30)/4, height: 24)
-//        collectionViewLayout.sectionInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
-//        return collectionViewLayout
-//    }()
-    
-    private lazy var collectionViewLayout: UICollectionViewFlowLayout = {
-        let collectionViewLayout = UICollectionViewFlowLayout()
+    private lazy var collectionViewLayout: UICollectionViewLeftAlignedLayout = {
+        let collectionViewLayout = UICollectionViewLeftAlignedLayout.init()
         collectionViewLayout.minimumLineSpacing = 10
         collectionViewLayout.minimumInteritemSpacing =  10
         collectionViewLayout.scrollDirection = UICollectionView.ScrollDirection.vertical
@@ -234,6 +226,16 @@ class CommunityRecommendDetailHTMLTableViewCell: UITableViewCell {
         return collectionViewLayout
     }()
     
+//    private lazy var collectionViewLayout: UICollectionViewFlowLayout = {
+//        let collectionViewLayout = UICollectionViewFlowLayout()
+//        collectionViewLayout.minimumLineSpacing = 10
+//        collectionViewLayout.minimumInteritemSpacing =  10
+//        collectionViewLayout.scrollDirection = UICollectionView.ScrollDirection.vertical
+//        collectionViewLayout.estimatedItemSize = CGSize(width: ((kScreenWidth - 28) - 30)/4, height: 24)
+//        collectionViewLayout.sectionInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
+//        return collectionViewLayout
+//    }()
+    
     lazy var locationButton: UIButton = {
         let locationButton = UIButton(type: UIButton.ButtonType.custom)
         locationButton.setImage(kImage(name: "btn_address"), for: UIControl.State.normal)
@@ -258,8 +260,8 @@ class CommunityRecommendDetailHTMLTableViewCell: UITableViewCell {
         //更新collectionView的高度约束
         let contentSize = self.collectionView.collectionViewLayout.collectionViewContentSize
         collectionViewheight = contentSize.height
-        collectionView.snp.remakeConstraints { (make) in
-            make.top.equalTo(webView.snp_bottom).offset(15)
+        collectionView.snp.remakeConstraints {[weak self] (make) in
+            make.top.equalTo((self?.webView.snp_bottom)!).offset(15)
             make.left.equalTo(14)
             make.right.equalTo(-14)
             make.height.equalTo(contentSize.height)
@@ -312,8 +314,6 @@ class CommunityRecommendDetailHTMLTableViewCell: UITableViewCell {
                 locationButton.setTitle(communityPostDetailModel?.location, for: UIControl.State.normal)
                 locationButton.layoutButton(edgeInsetsStyle: ButtonEdgeInsetsStyle.left, imageTitleSpace: 3)
             }
-            webView.scrollView.addObserver(self, forKeyPath: "contentSize", options: NSKeyValueObservingOptions.new, context: nil)
-
         }
     }
     
@@ -381,10 +381,14 @@ extension CommunityRecommendDetailHTMLTableViewCell: UICollectionViewDelegateFlo
 
 extension CommunityRecommendDetailHTMLTableViewCell {
     override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {
-        weak var weakself = self
         if keyPath == "contentSize" {
-            webViewCellHeight = weakself?.webView.scrollView.contentSize.height
-            weakself?.tableView?.reloadData()
+            if communityPostDetailModel != nil {
+                
+                if self.webView.scrollView.contentSize.height != webViewCellHeight {
+                    self.tableView?.reloadData()
+                }
+                self.webViewCellHeight = self.webView.scrollView.contentSize.height
+            }
         }
     }
 }

+ 1 - 1
RainbowPlanet/RainbowPlanet/Modules/SearchModule/SearchContentList/View/SearchContentListCollectionCell.swift

@@ -223,7 +223,7 @@ class SearchContentListCollectionCell: UICollectionViewCell {
     
     var communityPostDataModel : CommunityPostDataModel? {
         didSet {
-            contentImageView.kf.setImage(with: kURLImage(name: communityPostDataModel?.img ?? ""), placeholder: kImage(name: "default_pic"))
+            contentImageView.kf.setImage(with: kURLThumbnailsImage(name: communityPostDataModel?.img ?? "",size: CGSize(width: self.size.width, height: (kScreenWidth-15)/2)), placeholder: kImage(name: "default_pic"))
             titleLabel.text = communityPostDataModel?.title
             if communityPostDataModel?.title == "" || communityPostDataModel?.title == nil {
                 titleLabel.text = communityPostDataModel?.content?.replacingOccurrences(of: "\n", with: "").replacingOccurrences(of: "\r", with: "")