Commit 445f7233ac78afdf4d7ff9043963bffb4ce3f97a

Authored by 张旭
1 parent 8e112436

新增商品,编辑商品 返回按钮无法点击问题

metaCode/Classes/Common/Base/CNLiveBaseViewController.swift
@@ -226,6 +226,12 @@ class CNLiveBaseViewController: UIViewController { @@ -226,6 +226,12 @@ class CNLiveBaseViewController: UIViewController {
226 if viewControllers!.count > 1 { 226 if viewControllers!.count > 1 {
227 if viewControllers?.last == self { 227 if viewControllers?.last == self {
228 self.navigationController!.popViewController(animated: true) 228 self.navigationController!.popViewController(animated: true)
  229 + }else{
  230 + viewControllers?.last?.children.forEach({ vc in
  231 + if vc == self{
  232 + self.navigationController!.popViewController(animated: true)
  233 + }
  234 + })
229 } 235 }
230 }else{ 236 }else{
231 if (self.presentingViewController != nil) { 237 if (self.presentingViewController != nil) {
metaCode/Classes/Main/HomePage/Controller/GoodsManager/CNLiveGoodsCategoryController.swift
@@ -176,9 +176,8 @@ class CNLiveGoodsCategoryController: CNLiveBaseViewController, UITableViewDataSo @@ -176,9 +176,8 @@ class CNLiveGoodsCategoryController: CNLiveBaseViewController, UITableViewDataSo
176 176
177 override func viewDidLoad() { 177 override func viewDidLoad() {
178 super.viewDidLoad() 178 super.viewDidLoad()
179 - 179 + navigationBarHidden = false
180 self.view.backgroundColor = .clear 180 self.view.backgroundColor = .clear
181 - self.topNavView.removeFromSuperview()  
182 self.initUI() 181 self.initUI()
183 if self.firCategoryId == 0{ 182 if self.firCategoryId == 0{
184 self.secCategoryId = 0 183 self.secCategoryId = 0
@@ -201,11 +200,16 @@ class CNLiveGoodsCategoryController: CNLiveBaseViewController, UITableViewDataSo @@ -201,11 +200,16 @@ class CNLiveGoodsCategoryController: CNLiveBaseViewController, UITableViewDataSo
201 self.postShopClassify() 200 self.postShopClassify()
202 } 201 }
203 } 202 }
  203 +
  204 + func initTitleName(name:String){
  205 + titleName = name
  206 + }
  207 +
204 // MARK: - initUI 208 // MARK: - initUI
205 func initUI(){ 209 func initUI(){
206 - self.shadowView = UIView(frame: self.view.bounds) 210 + self.shadowView = UIView(frame: CGRect(x: 0, y: KNavigationHeight, width: self.view.width, height: self.view.height - KNavigationHeight))
207 self.shadowView?.backgroundColor = UIColor(white: 0, alpha: 0.26) 211 self.shadowView?.backgroundColor = UIColor(white: 0, alpha: 0.26)
208 - self.shadowView?.alpha = 0 212 + self.shadowView?.isHidden = true
209 self.view.addSubview(self.shadowView!) 213 self.view.addSubview(self.shadowView!)
210 let shadowViewTap = UITapGestureRecognizer(target: self, action: #selector(shadowViewTap)) 214 let shadowViewTap = UITapGestureRecognizer(target: self, action: #selector(shadowViewTap))
211 self.shadowView?.addGestureRecognizer(shadowViewTap) 215 self.shadowView?.addGestureRecognizer(shadowViewTap)
@@ -281,20 +285,20 @@ class CNLiveGoodsCategoryController: CNLiveBaseViewController, UITableViewDataSo @@ -281,20 +285,20 @@ class CNLiveGoodsCategoryController: CNLiveBaseViewController, UITableViewDataSo
281 285
282 self.view.isUserInteractionEnabled = true 286 self.view.isUserInteractionEnabled = true
283 UIView.animate(withDuration: 0.2) { 287 UIView.animate(withDuration: 0.2) {
284 - self.shadowView?.alpha = 1 288 + self.shadowView?.isHidden = false
285 self.contentView!.top = self.view.height-400 289 self.contentView!.top = self.view.height-400
286 } 290 }
287 } 291 }
288 public func hide(){ 292 public func hide(){
289 UIView.animate(withDuration: 0.2) { 293 UIView.animate(withDuration: 0.2) {
290 - self.shadowView?.alpha = 0 294 + self.shadowView?.isHidden = true
291 self.contentView!.top = self.view.height 295 self.contentView!.top = self.view.height
292 }completion: { finished in 296 }completion: { finished in
293 self.view.isUserInteractionEnabled = false 297 self.view.isUserInteractionEnabled = false
294 } 298 }
295 } 299 }
296 public func hideView(){ 300 public func hideView(){
297 - self.shadowView?.alpha = 0 301 + self.shadowView?.isHidden = true
298 self.contentView!.top = self.view.height 302 self.contentView!.top = self.view.height
299 self.view.isUserInteractionEnabled = false 303 self.view.isUserInteractionEnabled = false
300 } 304 }
metaCode/Classes/Main/HomePage/Controller/GoodsManager/CNLiveShopNewProductController.swift
@@ -58,7 +58,7 @@ class CNLiveShopNewProductController:CNLiveBaseViewController{ @@ -58,7 +58,7 @@ class CNLiveShopNewProductController:CNLiveBaseViewController{
58 singleView1.layoutSubviews() 58 singleView1.layoutSubviews()
59 } 59 }
60 self.addChild(vc) 60 self.addChild(vc)
61 - vc.view.frame = CGRect(x: 0, y: 0, width: self.view.width, height: self.view.height) 61 + vc.view.frame = CGRect(x: 0, y: KNavigationHeight, width: self.view.width, height: self.view.height-KNavigationHeight)
62 vc.didMove(toParent: self) 62 vc.didMove(toParent: self)
63 self.view.addSubview(vc.view) 63 self.view.addSubview(vc.view)
64 _selectCategoryVC = vc 64 _selectCategoryVC = vc
@@ -170,12 +170,11 @@ class CNLiveShopNewProductController:CNLiveBaseViewController{ @@ -170,12 +170,11 @@ class CNLiveShopNewProductController:CNLiveBaseViewController{
170 } 170 }
171 } 171 }
172 func setUI(){ 172 func setUI(){
173 - navigationBarHidden = false  
174 titleName = "新增商品" 173 titleName = "新增商品"
175 if (self.type == .add) { 174 if (self.type == .add) {
176 - titleName = "新增商品" 175 + self.selectCategoryVC?.initTitleName(name: "新增商品")
177 }else { 176 }else {
178 - titleName = "编辑商品" 177 + self.selectCategoryVC?.initTitleName(name: "编辑商品")
179 let deleteNavBtn = UIButton(type: .custom) 178 let deleteNavBtn = UIButton(type: .custom)
180 deleteNavBtn.frame = CGRect(x: 0, y: KStatusBarHeight, width: KNavigationHeight-KStatusBarHeight, height: KNavigationHeight-KStatusBarHeight) 179 deleteNavBtn.frame = CGRect(x: 0, y: KStatusBarHeight, width: KNavigationHeight-KStatusBarHeight, height: KNavigationHeight-KStatusBarHeight)
181 deleteNavBtn.backgroundColor = .clear 180 deleteNavBtn.backgroundColor = .clear