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