瀏覽代碼

发布弹框 0.5

南鑫林 5 年之前
父節點
當前提交
47e2c0f7aa

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

@@ -300,6 +300,8 @@
 		A784F2B32350337D00E49140 /* ShareH5LinkView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A784F2B22350337D00E49140 /* ShareH5LinkView.swift */; };
 		A784F2B623505D3F00E49140 /* CardTitleHTMLTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A784F2B523505D3F00E49140 /* CardTitleHTMLTableViewCell.swift */; };
 		A784F2B823505E3700E49140 /* CardContentPicHTMLTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A784F2B723505E3700E49140 /* CardContentPicHTMLTableViewCell.swift */; };
+		A784F2BB23506E1A00E49140 /* PublishNewPopButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = A784F2BA23506E1A00E49140 /* PublishNewPopButton.swift */; };
+		A784F2BD2350730C00E49140 /* PublishNewPopView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A784F2BC2350730C00E49140 /* PublishNewPopView.swift */; };
 		A78A5F7622FAA03800DD1764 /* share_iSpt.gif in Resources */ = {isa = PBXBuildFile; fileRef = A78A5F7522FAA03800DD1764 /* share_iSpt.gif */; };
 		A78A5F7822FAC7F000DD1764 /* SetGenderModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A78A5F7722FAC7F000DD1764 /* SetGenderModel.swift */; };
 		A78CEE0A22E0864100C512A4 /* BaseLottieAnimateContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A78CEE0922E0864100C512A4 /* BaseLottieAnimateContentView.swift */; };
@@ -988,6 +990,8 @@
 		A784F2B22350337D00E49140 /* ShareH5LinkView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareH5LinkView.swift; sourceTree = "<group>"; };
 		A784F2B523505D3F00E49140 /* CardTitleHTMLTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CardTitleHTMLTableViewCell.swift; sourceTree = "<group>"; };
 		A784F2B723505E3700E49140 /* CardContentPicHTMLTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CardContentPicHTMLTableViewCell.swift; sourceTree = "<group>"; };
+		A784F2BA23506E1A00E49140 /* PublishNewPopButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PublishNewPopButton.swift; sourceTree = "<group>"; };
+		A784F2BC2350730C00E49140 /* PublishNewPopView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PublishNewPopView.swift; sourceTree = "<group>"; };
 		A78A5F7522FAA03800DD1764 /* share_iSpt.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = share_iSpt.gif; sourceTree = "<group>"; };
 		A78A5F7722FAC7F000DD1764 /* SetGenderModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SetGenderModel.swift; sourceTree = "<group>"; };
 		A78CEE0922E0864100C512A4 /* BaseLottieAnimateContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseLottieAnimateContentView.swift; sourceTree = "<group>"; };
@@ -3154,6 +3158,7 @@
 		A7811CCE2323D25A00C2D8DE /* View */ = {
 			isa = PBXGroup;
 			children = (
+				A784F2B923506DFD00E49140 /* PublishNewPopView */,
 				A78168EC2341F3D200033496 /* PublishNewEffect */,
 				A75AEE552340890A0092413C /* PublishNewView */,
 				A75AEE5223404D0A0092413C /* PublishNewAuthorization */,
@@ -3291,6 +3296,15 @@
 			path = CopyLabel;
 			sourceTree = "<group>";
 		};
+		A784F2B923506DFD00E49140 /* PublishNewPopView */ = {
+			isa = PBXGroup;
+			children = (
+				A784F2BA23506E1A00E49140 /* PublishNewPopButton.swift */,
+				A784F2BC2350730C00E49140 /* PublishNewPopView.swift */,
+			);
+			path = PublishNewPopView;
+			sourceTree = "<group>";
+		};
 		A78A5F7422FAA01F00DD1764 /* Gif */ = {
 			isa = PBXGroup;
 			children = (
@@ -5621,6 +5635,7 @@
 				A75B782C22DEC908007B986A /* SpecialTwoTypeCollectionViewCell.swift in Sources */,
 				A763BE6E22F1953D000CE594 /* CommunityFollowLoginTableHeaderView.swift in Sources */,
 				A714348722DD9D4700132DA9 /* RedemptionAreaViewController.swift in Sources */,
+				A784F2BD2350730C00E49140 /* PublishNewPopView.swift in Sources */,
 				A73A56DE22DC9CCE004920FE /* UpdateVersionManager.swift in Sources */,
 				A7D5F22B22BB687100F8E9AF /* BaseJSWebViewController.swift in Sources */,
 				BD1DC6C5228CFD0B00B89C57 /* SwiftMoyaNetWorkServiceOrder.swift in Sources */,
@@ -5746,6 +5761,7 @@
 				A7EE6E1223055A5A00628D39 /* MemoryManager.swift in Sources */,
 				BD61225422C355C800D3F513 /* AliyunMagicCameraViewController.m in Sources */,
 				BDAF83A222B330540004BCC3 /* RecommendSimilarCell.swift in Sources */,
+				A784F2BB23506E1A00E49140 /* PublishNewPopButton.swift in Sources */,
 				BD2FCBE222B21CF70006D974 /* CommunityRecommendController.swift in Sources */,
 				A71AA51F22729F35008FF1A5 /* AuthorizationSwift.swift in Sources */,
 				A770E61222D6625700CBD0A4 /* ShareCommunityContentView.swift in Sources */,

+ 31 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishNewModule/PublishNew/View/PublishNewPopView/PublishNewPopButton.swift

@@ -0,0 +1,31 @@
+//
+//  PublishNewPopButton.swift
+//  RainbowPlanet
+//
+//  Created by 南鑫林 on 2019/10/11.
+//  Copyright © 2019 RainbowPlanet. All rights reserved.
+//
+
+import UIKit
+
+let iconHeight : CGFloat = 60.0
+let titleHeight : CGFloat = 20.0
+let spacingHeight : CGFloat = 10.0
+
+class PublishNewPopButton: UIButton {
+    
+    override func imageRect(forContentRect contentRect: CGRect) -> CGRect {
+        let height : CGFloat = contentRect.size.height
+        let y = (height - iconHeight - titleHeight - spacingHeight) / 2
+        let rect = CGRect(x: 0.0, y: y, width: contentRect.size.width, height: iconHeight)
+        return rect
+    }
+    
+    override func titleRect(forContentRect contentRect: CGRect) -> CGRect {
+        let height : CGFloat = contentRect.size.height
+         let y = (height - iconHeight - titleHeight - spacingHeight) / 2 + iconHeight + spacingHeight
+        let rect = CGRect(x: 0.0, y: y, width: contentRect.size.width, height: titleHeight)
+        return rect
+    }
+    
+}

+ 74 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishNewModule/PublishNew/View/PublishNewPopView/PublishNewPopView.swift

@@ -0,0 +1,74 @@
+//
+//  PublishNewPopView.swift
+//  RainbowPlanet
+//
+//  Created by 南鑫林 on 2019/10/11.
+//  Copyright © 2019 RainbowPlanet. All rights reserved.
+//
+
+import UIKit
+
+class PublishNewPopView: UIView {
+    
+    var imageStrs : Array<String>?
+    var titles : Array<String>?
+    var columnCount : Int = 4
+    var scrollView : UIScrollView?
+    typealias SelectClosure = (Int) -> Void
+    var selectClosure : SelectClosure?
+    
+    class func show(imageStrs:Array<String>,titles:Array<String>,columnCount:Int = 4,selectClosure:@escaping (Int) ->Void)  {
+       
+        let publishNewPopView = PublishNewPopView(frame: CGRect(x: 0, y: 0, width: kScreenWidth, height: kScreenHeight))
+        publishNewPopView.backgroundColor = UIColor.clear
+        
+        let window = UIApplication.shared.keyWindow
+        window?.addSubview(publishNewPopView)
+        
+        let effect = UIBlurEffect(style: UIBlurEffect.Style.light)
+        let effectView = UIVisualEffectView(effect: effect)
+        effectView.frame = publishNewPopView.bounds
+        effectView.alpha = 0.8
+        publishNewPopView.addSubview(effectView)
+        
+        publishNewPopView.imageStrs = imageStrs
+        publishNewPopView.titles = titles
+        publishNewPopView.columnCount = columnCount
+        publishNewPopView.selectClosure = selectClosure
+        
+    }
+    
+    func setupMainView() {
+        let scrollView = UIScrollView(frame: CGRect(x: 0, y: kScreenHeight-170-48-kSafeTabBarHeight, width: kScreenWidth, height: 170))
+        let pages = (titles?.count ?? 1 - 1) / columnCount + 1
+        scrollView.contentSize = CGSize(width: scrollView.frame.size.width * CGFloat(pages), height: 0)
+        scrollView.isPagingEnabled = true
+        scrollView.showsHorizontalScrollIndicator = false
+        self.scrollView = scrollView
+        addSubview(scrollView)
+    }
+    
+    func setupItem() {
+        let hSpacing : CGFloat = 27.0
+        let itemWidth : CGFloat = (kScreenWidth - (hSpacing * 5.0)) / 4.0
+        let itemHeight : CGFloat = 90.0
+        
+        for i in 0 ..< (titles?.count ?? 0) {
+            let x : CGFloat = (CGFloat(i + 1) * hSpacing) + CGFloat(CGFloat(i) * itemWidth)
+            let y : CGFloat = 0.0
+            let button = PublishNewPopButton(frame: CGRect(x: x, y: y, width: itemWidth, height: itemHeight))
+            button.tag = 1000 + 1
+            button.setTitle(titles?[i], for: UIControl.State.normal)
+            button.setTitleColor(k333333Color, for: UIControl.State.normal)
+            button.titleLabel?.font = kRegularFont14
+            button.setImage(kImage(name: imageStrs?[i] ?? "") , for: UIControl.State.normal)
+            button.imageView?.contentMode = .center
+//            button.addTarget(self, action: #selector(selectClick(:)), for: UIControl.Event.touchUpInside)
+
+        }
+    }
+    
+//    @objc func selectClick(sender:PublishNewPopButton) {
+//        
+//    }
+}