Commit 8b97830df08c60e2719014216f3b99959f7fee4f
1 parent
ae7dada4
卡片背景图
Showing
4 changed files
with
110 additions
and
61 deletions
metaCode/Classes/Main/HomePage/View/CNMainView.swift
| ... | ... | @@ -27,32 +27,49 @@ class CNFrontMainView : UIView{ |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | ///视图总容器 |
| 30 | - lazy var frontContentView : UIView = { | |
| 30 | + lazy var frontTotolContentView : UIView = { | |
| 31 | 31 | |
| 32 | - let frontContentView = UIView.init(frame: CGRect(x: 0, y: 0, width: self.width, height: self.height )) | |
| 33 | - frontContentView.backgroundColor = UIColor.white | |
| 34 | - frontContentView.clipsToBounds = true | |
| 35 | - frontContentView.layer.cornerRadius = 20 | |
| 36 | - frontContentView.addSubview(self.contentView) | |
| 37 | - return frontContentView | |
| 32 | + let frontTotolContentView = UIView.init(frame: CGRect(x: 0, y: 0, width: self.width, height: self.height )) | |
| 33 | + frontTotolContentView.backgroundColor = UIColor.white | |
| 34 | + frontTotolContentView.clipsToBounds = true | |
| 35 | + frontTotolContentView.layer.cornerRadius = 20 | |
| 36 | + return frontTotolContentView | |
| 38 | 37 | }() |
| 39 | 38 | |
| 40 | - /// 已认证-身份卡片 | |
| 41 | - lazy var iDCardView:CNIDCardView = { | |
| 39 | + ///未认证-前置视图身份描述容器 | |
| 40 | + lazy var frontDescContentView : UIView = { | |
| 42 | 41 | |
| 43 | - let iDCardView:CNIDCardView = CNIDCardView(frame: CGRect(x: 20, y: 25, width: self.width-40, height: (self.width-40) * 0.64)) | |
| 44 | - return iDCardView | |
| 45 | - }() | |
| 46 | - | |
| 47 | - /// 已认证-身份卡片 | |
| 48 | - lazy var textViewBgImgView:UIImageView = { | |
| 49 | - | |
| 50 | - let textViewBgImgView:UIImageView = UIImageView() | |
| 51 | - textViewBgImgView.clipsToBounds = true | |
| 52 | - textViewBgImgView.layer.cornerRadius = 20 | |
| 53 | - return textViewBgImgView | |
| 42 | + let frontDescContentView = UIView.init(frame: CGRect(x: 0, y: 0, width: self.width, height: self.height )) | |
| 43 | + frontDescContentView.backgroundColor = UIColor.white | |
| 44 | + frontDescContentView.clipsToBounds = true | |
| 45 | + frontDescContentView.layer.cornerRadius = 20 | |
| 46 | + frontDescContentView.addSubview(self.textViewBgImgView) | |
| 47 | + textViewBgImgView.snp.makeConstraints { make in | |
| 48 | + make.top.equalToSuperview() | |
| 49 | + make.left.equalToSuperview() | |
| 50 | + make.right.equalToSuperview() | |
| 51 | + make.bottom.equalToSuperview() | |
| 52 | + } | |
| 53 | + | |
| 54 | + frontDescContentView.addSubview(self.addStandBtn) | |
| 55 | + addStandBtn.snp.makeConstraints { make in | |
| 56 | + make.centerX.equalToSuperview() | |
| 57 | + make.bottom.equalToSuperview().offset(-30) | |
| 58 | + make.width.equalTo(150) | |
| 59 | + make.height.equalTo(39) | |
| 60 | + } | |
| 61 | + | |
| 62 | + frontDescContentView.addSubview(self.textView) | |
| 63 | + textView.snp.makeConstraints { make in | |
| 64 | + make.top.equalToSuperview().offset(40) | |
| 65 | + make.left.equalToSuperview().offset(30) | |
| 66 | + make.right.equalToSuperview().offset(-30) | |
| 67 | + make.bottom.equalTo(addStandBtn.snp.top).offset(-30) | |
| 68 | + } | |
| 69 | + | |
| 70 | + return frontDescContentView | |
| 71 | + | |
| 54 | 72 | }() |
| 55 | - | |
| 56 | 73 | //未认证下 textview |
| 57 | 74 | lazy var textView: UITextView = { |
| 58 | 75 | let textView = UITextView.init() |
| ... | ... | @@ -69,8 +86,7 @@ class CNFrontMainView : UIView{ |
| 69 | 86 | textView.backgroundColor = .clear |
| 70 | 87 | return textView |
| 71 | 88 | }() |
| 72 | - | |
| 73 | - ///点击添加身份 按钮 | |
| 89 | + ///未认证-点击添加身份 按钮 | |
| 74 | 90 | lazy var addStandBtn: UIButton = { |
| 75 | 91 | let addStandBtn = UIButton(type: .custom) |
| 76 | 92 | addStandBtn.clipsToBounds = true |
| ... | ... | @@ -83,39 +99,54 @@ class CNFrontMainView : UIView{ |
| 83 | 99 | return addStandBtn |
| 84 | 100 | }() |
| 85 | 101 | |
| 86 | - ///前置视图容器 | |
| 87 | - lazy var contentView : UIView = { | |
| 102 | + ///已认证-前置视图卡片容器 | |
| 103 | + lazy var frontCardContentView : UIView = { | |
| 88 | 104 | |
| 89 | - let contentView = UIView.init(frame: CGRect(x: 0, y: 0, width: self.width, height: self.height )) | |
| 90 | - contentView.backgroundColor = UIColor.white | |
| 91 | - contentView.clipsToBounds = true | |
| 92 | - contentView.layer.cornerRadius = 20 | |
| 93 | - contentView.addSubview(self.textViewBgImgView) | |
| 94 | - textViewBgImgView.snp.makeConstraints { make in | |
| 105 | + let frontCardContentView = UIView.init(frame: CGRect(x: 0, y: 0, width: self.width, height: self.height )) | |
| 106 | + frontCardContentView.backgroundColor = UIColor.white | |
| 107 | + frontCardContentView.clipsToBounds = true | |
| 108 | + frontCardContentView.layer.cornerRadius = 20 | |
| 109 | + frontCardContentView.addSubview(self.cardViewBgImgView) | |
| 110 | + cardViewBgImgView.snp.makeConstraints { make in | |
| 95 | 111 | make.top.equalToSuperview() |
| 96 | 112 | make.left.equalToSuperview() |
| 97 | 113 | make.right.equalToSuperview() |
| 98 | 114 | make.bottom.equalToSuperview() |
| 99 | 115 | } |
| 100 | 116 | |
| 101 | - contentView.addSubview(self.addStandBtn) | |
| 102 | - addStandBtn.snp.makeConstraints { make in | |
| 117 | + frontCardContentView.addSubview(self.iDCardView) | |
| 118 | + iDCardView.snp.makeConstraints { make in | |
| 103 | 119 | make.centerX.equalToSuperview() |
| 104 | - make.bottom.equalToSuperview().offset(-30) | |
| 105 | - make.width.equalTo(150) | |
| 106 | - make.height.equalTo(39) | |
| 107 | - } | |
| 108 | - | |
| 109 | - contentView.addSubview(self.textView) | |
| 110 | - textView.snp.makeConstraints { make in | |
| 111 | - make.top.equalToSuperview().offset(40) | |
| 112 | - make.left.equalToSuperview().offset(30) | |
| 113 | - make.right.equalToSuperview().offset(-30) | |
| 114 | - make.bottom.equalTo(addStandBtn.snp.top).offset(-30) | |
| 120 | + make.top.equalToSuperview().offset(25) | |
| 121 | + make.width.equalTo(self.width-40) | |
| 122 | + make.height.equalTo((self.width-40) * 0.64) | |
| 115 | 123 | } |
| 124 | + return frontCardContentView | |
| 116 | 125 | |
| 117 | - return contentView | |
| 118 | - | |
| 126 | + }() | |
| 127 | + /// 已认证-身份卡片 | |
| 128 | + lazy var iDCardView:CNIDCardView = { | |
| 129 | + | |
| 130 | + let iDCardView:CNIDCardView = CNIDCardView(frame: CGRect(x: 20, y: 25, width: self.width-40, height: (self.width-40) * 0.64)) | |
| 131 | + return iDCardView | |
| 132 | + }() | |
| 133 | + | |
| 134 | + /// 已认证-身份卡片 | |
| 135 | + lazy var textViewBgImgView:UIImageView = { | |
| 136 | + | |
| 137 | + let textViewBgImgView:UIImageView = UIImageView() | |
| 138 | + textViewBgImgView.clipsToBounds = true | |
| 139 | + textViewBgImgView.layer.cornerRadius = 20 | |
| 140 | + return textViewBgImgView | |
| 141 | + }() | |
| 142 | + | |
| 143 | + /// 已认证-卡片后的背景图 | |
| 144 | + lazy var cardViewBgImgView:UIImageView = { | |
| 145 | + | |
| 146 | + let cardViewBgImgView:UIImageView = UIImageView() | |
| 147 | + cardViewBgImgView.clipsToBounds = true | |
| 148 | + cardViewBgImgView.layer.cornerRadius = 20 | |
| 149 | + return cardViewBgImgView | |
| 119 | 150 | }() |
| 120 | 151 | |
| 121 | 152 | //IDmodel |
| ... | ... | @@ -130,15 +161,15 @@ class CNFrontMainView : UIView{ |
| 130 | 161 | if(auth == true){ |
| 131 | 162 | //已认证身份 |
| 132 | 163 | //显示证件View |
| 133 | - iDCardView.isHidden = false | |
| 164 | + frontCardContentView.isHidden = false | |
| 134 | 165 | iDCardView.idModel = newValue! |
| 135 | - contentView.isHidden = true | |
| 136 | - | |
| 166 | + frontDescContentView.isHidden = true | |
| 167 | + cardViewBgImgView.kf.setImage(with: URL(string: _idModel!.cardBackgroundImg), placeholder: UIImage(named: "homepage_cardBGImg")) | |
| 137 | 168 | }else |
| 138 | 169 | {//未认证身份 |
| 139 | - iDCardView.isHidden = true | |
| 170 | + frontCardContentView.isHidden = true | |
| 140 | 171 | //显示textview 添加身份 |
| 141 | - contentView.isHidden = false | |
| 172 | + frontDescContentView.isHidden = false | |
| 142 | 173 | textView.text = newValue!.description |
| 143 | 174 | addStandBtn.backgroundColor = HexColor(newValue!.backgroundColor) |
| 144 | 175 | textViewBgImgView.kf.setImage(with: URL(string: _idModel!.descBackgroundImg), placeholder: UIImage(named: "homepage_desc_bgImg")) |
| ... | ... | @@ -148,19 +179,15 @@ class CNFrontMainView : UIView{ |
| 148 | 179 | |
| 149 | 180 | func initUI() |
| 150 | 181 | { |
| 151 | - self.addSubview(self.frontContentView) | |
| 152 | - self.frontContentView.addSubview(self.contentView) | |
| 153 | - self.frontContentView.addSubview(self.iDCardView) | |
| 182 | + self.addSubview(self.frontTotolContentView) | |
| 183 | + self.frontTotolContentView.addSubview(self.frontDescContentView) | |
| 184 | + self.frontTotolContentView.addSubview(self.frontCardContentView) | |
| 185 | + | |
| 154 | 186 | |
| 155 | 187 | self.makeConstraints() |
| 156 | 188 | } |
| 157 | 189 | func makeConstraints(){ |
| 158 | - self.iDCardView.snp.makeConstraints { make in | |
| 159 | - make.centerX.equalToSuperview() | |
| 160 | - make.top.equalToSuperview().offset(25) | |
| 161 | - make.width.equalTo(self.width-40) | |
| 162 | - make.height.equalTo((self.width-40) * 0.64) | |
| 163 | - } | |
| 190 | + | |
| 164 | 191 | } |
| 165 | 192 | |
| 166 | 193 | // MARK: -按钮点击事件 |
| ... | ... | @@ -309,7 +336,7 @@ class CNMainView : UIView{ |
| 309 | 336 | |
| 310 | 337 | // MARK: - <##><##>设置前置视图容器 |
| 311 | 338 | func isHiddenMainFrontContentView(isHidden:Bool){ |
| 312 | - self.frontView.contentView.isHidden = isHidden | |
| 339 | + self.frontView.frontTotolContentView.isHidden = isHidden | |
| 313 | 340 | } |
| 314 | 341 | |
| 315 | 342 | // MARK: - 事件 | ... | ... |
metaCode/Supporting Files/Assets.xcassets/Home/homepage_cardBGImg.imageset/Contents.json
0 → 100644
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "scale" : "1x" | |
| 6 | + }, | |
| 7 | + { | |
| 8 | + "filename" : "homepage_cardBGImg@2x.png", | |
| 9 | + "idiom" : "universal", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "filename" : "homepage_cardBGImg@3x.png", | |
| 14 | + "idiom" : "universal", | |
| 15 | + "scale" : "3x" | |
| 16 | + } | |
| 17 | + ], | |
| 18 | + "info" : { | |
| 19 | + "author" : "xcode", | |
| 20 | + "version" : 1 | |
| 21 | + } | |
| 22 | +} | ... | ... |
metaCode/Supporting Files/Assets.xcassets/Home/homepage_cardBGImg.imageset/homepage_cardBGImg@2x.png
0 → 100644
24.7 KB
metaCode/Supporting Files/Assets.xcassets/Home/homepage_cardBGImg.imageset/homepage_cardBGImg@3x.png
0 → 100644
48.4 KB