Commit c89b1a4367ac21f11cb498d19c082b10b98f335a

Authored by 张旭
1 parent 5d940e41

偶发 push页面透明的问题

metaCode/Classes/Common/Base/CNLiveBaseNavigationController.swift
@@ -29,7 +29,8 @@ class CNLiveBaseNavigationController : UINavigationController, UIGestureRecogniz @@ -29,7 +29,8 @@ class CNLiveBaseNavigationController : UINavigationController, UIGestureRecogniz
29 func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool { 29 func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool {
30 return viewControllers.count > 1 30 return viewControllers.count > 1
31 } 31 }
32 - 32 +
  33 +
33 /// 重写push方法的目的 : 拦截所有push进来的子控制器 34 /// 重写push方法的目的 : 拦截所有push进来的子控制器
34 override func pushViewController(_ viewController: UIViewController, animated: Bool) { 35 override func pushViewController(_ viewController: UIViewController, animated: Bool) {
35 if (self.children.count > 0 ) { 36 if (self.children.count > 0 ) {
metaCode/Classes/Main/HomePage/Controller/CNMetaCodeHomePageController.swift
@@ -36,7 +36,7 @@ enum NetAPIStatus { @@ -36,7 +36,7 @@ enum NetAPIStatus {
36 case notNetwork 36 case notNetwork
37 } 37 }
38 38
39 -class CNMetaCodeHomePageController:CNLiveBaseViewController, NewPagedFlowViewDelegate, NewPagedFlowViewDataSource, CNCustomIndexViewDelegate{ 39 +class CNMetaCodeHomePageController:CNLiveBaseViewController, NewPagedFlowViewDelegate, NewPagedFlowViewDataSource, CNCustomIndexViewDelegate,UIGestureRecognizerDelegate{
40 40
41 41
42 ///NewPagedFlowView 开始滑动时的偏移量 42 ///NewPagedFlowView 开始滑动时的偏移量
@@ -184,6 +184,8 @@ class CNMetaCodeHomePageController:CNLiveBaseViewController, NewPagedFlowViewDel @@ -184,6 +184,8 @@ class CNMetaCodeHomePageController:CNLiveBaseViewController, NewPagedFlowViewDel
184 184
185 self.setupUI() 185 self.setupUI()
186 186
  187 + self.navigationController?.interactivePopGestureRecognizer?.delegate = self
  188 +
187 /// 网络通知 189 /// 网络通知
188 NotificationCenter.default.addObserver(self, selector: #selector(networkStatusNotificationActionNotReachable), name: Notification.Name.NetworkStatus.CNLiveNetworkStatusNotificationNotReachable, object: nil) 190 NotificationCenter.default.addObserver(self, selector: #selector(networkStatusNotificationActionNotReachable), name: Notification.Name.NetworkStatus.CNLiveNetworkStatusNotificationNotReachable, object: nil)
189 NotificationCenter.default.addObserver(self, selector: #selector(networkStatusNotificationActionUnknown), name: Notification.Name.NetworkStatus.CNLiveNetworkStatusNotificationUnknown, object: nil) 191 NotificationCenter.default.addObserver(self, selector: #selector(networkStatusNotificationActionUnknown), name: Notification.Name.NetworkStatus.CNLiveNetworkStatusNotificationUnknown, object: nil)
@@ -323,6 +325,17 @@ class CNMetaCodeHomePageController:CNLiveBaseViewController, NewPagedFlowViewDel @@ -323,6 +325,17 @@ class CNMetaCodeHomePageController:CNLiveBaseViewController, NewPagedFlowViewDel
323 } 325 }
324 } 326 }
325 327
  328 + // MARK: -左滑手势代理
  329 + func gestureRecognizerShouldBegin(_ gestureRecognizer:UIGestureRecognizer) ->Bool{
  330 +
  331 + if (gestureRecognizer == self.navigationController?.interactivePopGestureRecognizer) && (self.navigationController?.visibleViewController == self.navigationController?.viewControllers.first) {
  332 + ///解决执行了 push 之后,push不出界面的 bug,要在 rootvc 中实现这个方法 ,页面透明 , 只能用Debug view Hierarchy图层中看到
  333 + return false
  334 + }
  335 +
  336 + return true
  337 + }
  338 +
326 // MARK: - NewPagedFlowView代理 339 // MARK: - NewPagedFlowView代理
327 340
328 func numberOfPages(in flowView: NewPagedFlowView!) -> Int { 341 func numberOfPages(in flowView: NewPagedFlowView!) -> Int {
metaCode/Classes/Main/HomePage/View/CNIDCardView.swift
@@ -255,7 +255,7 @@ class CNIDCardView: UIView{ @@ -255,7 +255,7 @@ class CNIDCardView: UIView{
255 lazy var iDIconImgView:UIImageView = { 255 lazy var iDIconImgView:UIImageView = {
256 256
257 let iDIconImgView:UIImageView = UIImageView(frame: CGRect(x: 20, y: 25, width: 60, height: 85)) 257 let iDIconImgView:UIImageView = UIImageView(frame: CGRect(x: 20, y: 25, width: 60, height: 85))
258 - iDIconImgView.backgroundColor = UIColor.red 258 + iDIconImgView.backgroundColor = UIColor.clear
259 return iDIconImgView 259 return iDIconImgView
260 }() 260 }()
261 261