Prechádzať zdrojové kódy

1.修改加载loading逻辑

wenweiwei 3 rokov pred
rodič
commit
dc44d0f982

+ 1 - 1
BFCommonKit/Classes/BFBase/Controller/PQBaseViewController.swift

@@ -178,7 +178,7 @@ open class PQBaseViewController: UIViewController, UIGestureRecognizerDelegate {
         return isHiddenStatus
     }
 
-    /// 禁止滑动返回
+    /// 监听滑动返回
     /// - Returns: <#description#>
     public func disablePopGesture() -> PQBaseViewController {
         let traget = navigationController?.interactivePopGestureRecognizer?.delegate

+ 10 - 0
BFCommonKit/Classes/BFBase/View/PQLoadingHUB.swift

@@ -62,6 +62,9 @@ public class PQLoadingHUBView: UIView {
 
     /// 开始加载
     public func loading() {
+        if loadingImage.superview == nil {
+            addSubview(loadingImage)
+        }
         loadingImage.displayGIF(data: nil, images: gifImages, repeatCount: .max, duration: duration ?? 2)
     }
 
@@ -130,6 +133,13 @@ public class PQLoadingHUB: NSObject {
                 superView.addSubview(loadingHUB)
                 loadingHUB.loading()
                 self?.isLoading = true
+            } else if superView.viewWithTag(self!.viewTag) != nil {
+                if superView.viewWithTag(self!.viewTag)?.superview == nil {
+                    superView.addSubview(superView.viewWithTag(self!.viewTag)!)
+                } else {
+                    superView.bringSubviewToFront(superView.viewWithTag(self!.viewTag)!)
+                }
+                (superView.viewWithTag(self!.viewTag) as? PQLoadingHUBView)?.loading()
             }
         }
     }