南鑫林 лет назад: 5
Родитель
Сommit
ccd8bc5c3a

+ 0 - 4
RainbowPlanet/RainbowPlanet.xcodeproj/project.pbxproj

@@ -286,7 +286,6 @@
 		A7C0FDFB22B6672F00BC1E86 /* PopularVideoTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7C0FDFA22B6672F00BC1E86 /* PopularVideoTableViewCell.swift */; };
 		A7C0FE0022B66E5A00BC1E86 /* CommunityFeaturedTopicsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7C0FDFF22B66E5A00BC1E86 /* CommunityFeaturedTopicsViewController.swift */; };
 		A7C0FE0222B682DB00BC1E86 /* CommunityFeaturedTopicsHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7C0FE0122B682DB00BC1E86 /* CommunityFeaturedTopicsHeaderView.swift */; };
-		A7C0FE0422B68E7500BC1E86 /* CommunityFeaturedTopicsNavigationBarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7C0FE0322B68E7500BC1E86 /* CommunityFeaturedTopicsNavigationBarView.swift */; };
 		A7C3DD1A226422BF00FA262E /* SwiftMoyaServiceSMSApi.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7C3DD19226422BF00FA262E /* SwiftMoyaServiceSMSApi.swift */; };
 		A7C3DD1C226422D200FA262E /* SwiftMoyaNetWorkServiceSMS.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7C3DD1B226422D200FA262E /* SwiftMoyaNetWorkServiceSMS.swift */; };
 		A7CC74D4226FF1AA003C4F38 /* MineView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7CC74D3226FF1AA003C4F38 /* MineView.swift */; };
@@ -777,7 +776,6 @@
 		A7C0FDFA22B6672F00BC1E86 /* PopularVideoTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PopularVideoTableViewCell.swift; sourceTree = "<group>"; };
 		A7C0FDFF22B66E5A00BC1E86 /* CommunityFeaturedTopicsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommunityFeaturedTopicsViewController.swift; sourceTree = "<group>"; };
 		A7C0FE0122B682DB00BC1E86 /* CommunityFeaturedTopicsHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommunityFeaturedTopicsHeaderView.swift; sourceTree = "<group>"; };
-		A7C0FE0322B68E7500BC1E86 /* CommunityFeaturedTopicsNavigationBarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommunityFeaturedTopicsNavigationBarView.swift; sourceTree = "<group>"; };
 		A7C3DD19226422BF00FA262E /* SwiftMoyaServiceSMSApi.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftMoyaServiceSMSApi.swift; sourceTree = "<group>"; };
 		A7C3DD1B226422D200FA262E /* SwiftMoyaNetWorkServiceSMS.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftMoyaNetWorkServiceSMS.swift; sourceTree = "<group>"; };
 		A7CC74D3226FF1AA003C4F38 /* MineView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MineView.swift; sourceTree = "<group>"; };
@@ -2853,7 +2851,6 @@
 			isa = PBXGroup;
 			children = (
 				A7C0FE0122B682DB00BC1E86 /* CommunityFeaturedTopicsHeaderView.swift */,
-				A7C0FE0322B68E7500BC1E86 /* CommunityFeaturedTopicsNavigationBarView.swift */,
 			);
 			path = View;
 			sourceTree = "<group>";
@@ -4306,7 +4303,6 @@
 				A72A72D022321E2700B21995 /* FontMacro.swift in Sources */,
 				BD2FCBE622B2586C0006D974 /* CommunityTagCollectionCell.swift in Sources */,
 				BD1DC6C9228D005000B89C57 /* OrderCreateParameterModel.swift in Sources */,
-				A7C0FE0422B68E7500BC1E86 /* CommunityFeaturedTopicsNavigationBarView.swift in Sources */,
 				A7BF203422B47E8600396DB3 /* CardContentActionTableViewCell.swift in Sources */,
 				A71AA52622732068008FF1A5 /* SwiftMoyaServiceConfigApi.swift in Sources */,
 				A77F2C982231FD25001BD3F6 /* BaseNavigationViewController.swift in Sources */,

+ 1 - 0
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/Cell/CardContent/PicVideo/CardContentPicVideoTableViewCell.swift

@@ -50,6 +50,7 @@ class CardContentPicVideoTableViewCell: UITableViewCell {
         collectionView.dataSource = self;
         collectionView.showsVerticalScrollIndicator = false
         collectionView.showsHorizontalScrollIndicator = false
+        collectionView.isScrollEnabled = false
         return collectionView
     }()
     

+ 1 - 1
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/Cell/FeaturedTopics/FeaturedTopicsTableViewCell.swift

@@ -4,7 +4,7 @@
 //
 //  Created by 南鑫林 on 2019/6/16.
 //  Copyright © 2019 RainbowPlanet. All rights reserved.
-//
+// 精选话题cell
 
 import UIKit
 

+ 0 - 101
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityFeaturedTopics/View/CommunityFeaturedTopicsNavigationBarView.swift

@@ -1,101 +0,0 @@
-//
-//  CommunityFeaturedTopicsNavigationBarView.swift
-//  RainbowPlanet
-//
-//  Created by 南鑫林 on 2019/6/16.
-//  Copyright © 2019 RainbowPlanet. All rights reserved.
-//
-
-import UIKit
-
-class CommunityFeaturedTopicsNavigationBarView: BaseView {
-    
-    override func setupViews() {
-        self.clipsToBounds = true
-        self.backgroundColor = UIColor(hexString: "000000", alpha: 0.4)
-        addSubview(bgImageView)
-        addSubview(backButton)
-        addSubview(topicLable)
-        addSubview(topicButton)
-        addSubview(followButton)
-        
-    }
-    
-    override func setupLayouts() {
-        bgImageView.snp_makeConstraints { (make) in
-            make.top.right.left.equalToSuperview()
-            make.height.equalTo(kScreenWidth)
-        }
-        backButton.snp_makeConstraints { (make) in
-            make.bottom.equalTo(-11)
-            make.size.equalTo(22)
-            make.left.equalTo(14)
-        }
-        topicLable.snp_makeConstraints { (make) in
-            make.centerY.equalTo(backButton)
-            make.left.equalTo(backButton.snp_right).offset(10)
-        }
-        topicButton.snp_makeConstraints { (make) in
-            make.right.equalTo(-14)
-            make.centerY.equalTo(backButton)
-        }
-        followButton.snp_makeConstraints { (make) in
-            make.centerY.equalTo(backButton)
-            make.height.equalTo(24)
-            make.width.equalTo(60)
-            make.right.equalTo(-14)
-        }
-    }
-    
-    private lazy var bgImageView: UIImageView = {
-        let bgImageView = UIImageView()
-        bgImageView.backgroundColor = UIColor(hexString: "000000", alpha: 0.4)
-        bgImageView.image = kImage(name: "pic_preload")
-        bgImageView.masksToBounds = true
-        return bgImageView
-    }()
-    
-    private lazy var backButton: UIButton = {
-        let backButton = UIButton(type: UIButton.ButtonType.custom)
-        backButton.setImage(kImage(name: "navbar_back_white"), for: UIControl.State.normal)
-        return backButton
-    }()
-    
-    private lazy var topicLable: UILabel = {
-        let topicLable = UILabel()
-        topicLable.textColor = kffffffColor
-        topicLable.font = kRegularFont14
-        return topicLable
-    }()
-    
-    private lazy var topicButton: UIButton = {
-        let topicButton = UIButton(type: UIButton.ButtonType.custom)
-        topicButton.setTitle("我的话题", for: UIControl.State.normal)
-        topicButton.setTitleColor(kffffffColor, for: UIControl.State.normal)
-        topicButton.titleLabel?.font = kMediumFont14
-        return topicButton
-    }()
-    
-    typealias FollowClosureName = (UIButton) -> Bool
-    var followClosureName : FollowClosureName?
-    private lazy var followButton: UIButton = {
-        let followButton = UIButton(type: UIButton.ButtonType.custom)
-        followButton.setTitle("关注", for: UIControl.State.normal)
-        followButton.setImage(kImage(name: "center_attention_white"), for: UIControl.State.normal)
-        followButton.setImage(kImage(name: "center_followed_white"), for: UIControl.State.selected)
-        followButton.setBackgroundImage(UIImage.imageWithColor(color: kThemeColor), for:  UIControl.State.normal)
-        followButton.setBackgroundImage(UIImage.imageWithColor(color: UIColor.clear), for: UIControl.State.selected)
-        followButton.titleLabel?.font = kMediumFont13
-        followButton.cornerRadius = 12
-        followButton.masksToBounds = true
-        followButton.rx.tap.subscribe(onNext: {
-            [weak self] (data) in
-            if let followClosureName = self?.followClosureName {
-                followButton.isSelected = followClosureName(followButton)
-            }
-        }).disposed(by: disposeBag)
-        return followButton
-    }()
-    
-
-}

+ 89 - 10
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityFeaturedTopics/ViewController/CommunityFeaturedTopicsViewController.swift

@@ -20,11 +20,27 @@ class CommunityFeaturedTopicsViewController: BaseViewController {
     }
     
     override func setupViews() {
-        navigationBar.isHidden = true
         view.addSubview(bgImageView)
         view.addSubview(tableView)
-        view.addSubview(communityFeaturedTopicsNavigationBarView)
-        
+        view.insertSubview(navigationBar, aboveSubview: tableView)
+        setnavigationBar()
+    }
+    
+    func setnavigationBar() {
+        navigationBar.addSubview(navigationBgView)
+        navigationBar.addSubview(topicLable)
+        navigationBar.addSubview(followButton)
+        navigationBar.insertSubview(navigationBgView, aboveSubview: navigationBar.backgroundImageView)
+        navigationBar.backgroundImageView.frame = CGRect(x: 0, y: 0, width: kScreenWidth, height: kScreenWidth)
+        navigationBar.clipsToBounds = true
+        navigationBar.wr_setLeftButton(image: kImage(name: "navbar_back_white")!)
+        navigationBar.wr_setRightButton(title: "我的话题", titleColor: .white)
+        // 设置导航栏显示图片
+        navigationBar.barBackgroundImage = UIImage(named: "pic_example_12")
+        // 设置初始导航栏透明度
+        navigationBar.wr_setBackgroundAlpha(alpha: 0)
+        // 设置状态栏style
+        statusBarStyle = .lightContent
     }
     
     override func setupLayouts() {
@@ -35,9 +51,18 @@ class CommunityFeaturedTopicsViewController: BaseViewController {
         tableView.snp.makeConstraints { (make) in
             make.top.left.right.bottom.equalToSuperview()
         }
-        communityFeaturedTopicsNavigationBarView.snp_makeConstraints { (make) in
-            make.top.left.right.equalToSuperview()
-            make.height.equalTo(kNavBarTotalHeight)
+        navigationBgView.snp_makeConstraints { (make) in
+            make.edges.equalTo(navigationBar)
+        }
+        topicLable.snp_makeConstraints { (make) in
+            make.centerY.equalTo(navigationBar.leftButton)
+            make.left.equalTo(navigationBar.leftButton.snp_right)
+        }
+        followButton.snp_makeConstraints { (make) in
+            make.right.equalTo(-14)
+            make.centerY.equalTo(navigationBar.leftButton)
+            make.width.equalTo(60)
+            make.height.equalTo(24)
         }
     }
     
@@ -70,7 +95,7 @@ class CommunityFeaturedTopicsViewController: BaseViewController {
     
     private lazy var bgImageView: UIImageView = {
         let bgImageView = UIImageView()
-        bgImageView.image = kImage(name: "pic_preload")
+        bgImageView.image = kImage(name: "pic_example_12")
         return bgImageView
     }()
     
@@ -79,9 +104,38 @@ class CommunityFeaturedTopicsViewController: BaseViewController {
         return communityFeaturedTopicsHeaderView
     }()
     
-    private lazy var communityFeaturedTopicsNavigationBarView: CommunityFeaturedTopicsNavigationBarView = {
-        let communityFeaturedTopicsNavigationBarView = CommunityFeaturedTopicsNavigationBarView()
-        return communityFeaturedTopicsNavigationBarView
+    private lazy var topicLable: UILabel = {
+        let topicLable = UILabel()
+        topicLable.textColor = kffffffColor
+        topicLable.font = kRegularFont14
+        topicLable.text = "运动健身"
+        topicLable.alpha = 0
+        return topicLable
+    }()
+    
+    private lazy var followButton: UIButton = {
+        let followButton = UIButton(type: UIButton.ButtonType.custom)
+        followButton.setTitle("关注", for: UIControl.State.normal)
+        followButton.setImage(kImage(name: "center_attention_white"), for: UIControl.State.normal)
+        followButton.setImage(kImage(name: "center_followed_white"), for: UIControl.State.selected)
+        followButton.setBackgroundImage(UIImage.imageWithColor(color: kThemeColor), for:  UIControl.State.normal)
+        followButton.setBackgroundImage(UIImage.imageWithColor(color: UIColor.clear), for: UIControl.State.selected)
+        followButton.titleLabel?.font = kMediumFont13
+        followButton.alpha = 0
+        followButton.cornerRadius = 12
+        followButton.masksToBounds = true
+        followButton.rx.tap.subscribe(onNext: {
+            [weak self] (data) in
+            followButton.isSelected = !followButton.isSelected
+        }).disposed(by: disposeBag)
+        return followButton
+    }()
+    
+    private lazy var navigationBgView: UIView = {
+        let navigationBgView = UIView()
+        navigationBgView.backgroundColor = UIColor(hexString: "000000", alpha: 0.4)
+        navigationBgView.alpha = 0
+        return navigationBgView
     }()
     
     /// 关注接口
@@ -90,6 +144,31 @@ class CommunityFeaturedTopicsViewController: BaseViewController {
     }
 }
 
+extension CommunityFeaturedTopicsViewController
+{
+    func scrollViewDidScroll(_ scrollView: UIScrollView)
+    {
+        let offsetY = scrollView.contentOffset.y
+        if (offsetY > kSafeStatusBarHeight)
+        {
+            let alpha = (offsetY - kSafeStatusBarHeight) / CGFloat(kNavBarTotalHeight)
+            navigationBar.wr_setBackgroundAlpha(alpha: alpha)
+            followButton.alpha = alpha
+            topicLable.alpha = alpha
+            navigationBgView.alpha = alpha
+            navigationBar.rightButton.alpha = 1 - alpha
+        }
+        else
+        {
+            navigationBar.wr_setBackgroundAlpha(alpha: 0)
+            followButton.alpha = 0
+            topicLable.alpha = 0
+            navigationBgView.alpha = 0
+            navigationBar.rightButton.alpha = 1
+        }
+    }
+}
+
 extension CommunityFeaturedTopicsViewController : UITableViewDelegate,UITableViewDataSource {
     func numberOfSections(in tableView: UITableView) -> Int {
        return 15

+ 22 - 0
RainbowPlanet/RainbowPlanet/Supporting Files/CommunityModule.xcassets/pic_example_12.imageset/Contents.json

@@ -0,0 +1,22 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "pic_example_12@2x.png",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "pic_example_12@3x.png",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

BIN
RainbowPlanet/RainbowPlanet/Supporting Files/CommunityModule.xcassets/pic_example_12.imageset/pic_example_12@2x.png


BIN
RainbowPlanet/RainbowPlanet/Supporting Files/CommunityModule.xcassets/pic_example_12.imageset/pic_example_12@3x.png


+ 1 - 1
RainbowPlanet/RainbowPlanet/Tools/WRNavigationBar/WRCustomNavigationBar.swift

@@ -142,7 +142,7 @@ class WRCustomNavigationBar: UIView
         return view
     }()
     
-    fileprivate lazy var backgroundImageView:UIImageView = {
+    lazy var backgroundImageView:UIImageView = {
         let imgView = UIImageView()
         imgView.isHidden = true
         return imgView