Browse Source

toast message 居中

huzhiqiang 3 years ago
parent
commit
c1f7dde454
1 changed files with 4 additions and 2 deletions
  1. 4 2
      BFCommonKit/Classes/BFUtility/PQCommonMethodUtil.swift

+ 4 - 2
BFCommonKit/Classes/BFUtility/PQCommonMethodUtil.swift

@@ -423,18 +423,20 @@ public func getMachineCode() -> String {
 ///   - msg: <#msg description#>
 ///   - msg: <#msg description#>
 /// - Returns: <#description#>
 /// - Returns: <#description#>
 public func cShowHUB(superView: UIView?, msg: String?) {
 public func cShowHUB(superView: UIView?, msg: String?) {
+    var sty : ToastStyle = ToastManager.shared.style
+    sty.messageAlignment = .center
     DispatchQueue.main.async {
     DispatchQueue.main.async {
         if superView == nil {
         if superView == nil {
             if msg == nil {
             if msg == nil {
                 UIApplication.shared.keyWindow?.makeToastActivity(.center)
                 UIApplication.shared.keyWindow?.makeToastActivity(.center)
             } else {
             } else {
-                UIApplication.shared.keyWindow?.makeToast(msg, duration: 3.0, position: .center)
+                UIApplication.shared.keyWindow?.makeToast(msg, duration: 3.0, position: .center, style: sty)
             }
             }
         } else {
         } else {
             if msg == nil {
             if msg == nil {
                 superView!.makeToastActivity(.center)
                 superView!.makeToastActivity(.center)
             } else {
             } else {
-                superView!.makeToast(msg, duration: 3.0, position: .center)
+                superView!.makeToast(msg, duration: 3.0, position: .center,style: sty)
             }
             }
         }
         }
     }
     }