Ver Fonte

toast样式

harry há 3 anos atrás
pai
commit
8e09475202
1 ficheiros alterados com 21 adições e 5 exclusões
  1. 21 5
      BFCommonKit/Classes/BFUtility/PQCommonMethodUtil.swift

+ 21 - 5
BFCommonKit/Classes/BFUtility/PQCommonMethodUtil.swift

@@ -411,16 +411,32 @@ public func getMachineCode() -> String {
     return uuid
 }
 
+public func styleType(_ type:Int) -> ToastStyle{
+    var syt = ToastStyle()
+    switch type {
+    case 1 :
+        syt.messageColor = .black
+        syt.backgroundColor = .white
+        syt.messageFont = UIFont.boldSystemFont(ofSize: 22)
+        syt.cornerRadius = 4
+        syt.messageAlignment = .center
+    default:
+        syt = ToastManager.shared.style
+        syt.messageAlignment = .center
+    }
+    
+    return syt
+}
+
 /// 显示加载中视图
 /// - Parameters:
 ///   - superView: <#superView description#>
 ///   - msg: <#msg description#>
-/// - Returns: <#description#>
-public func cShowHUB(superView: UIView?, msg: String?) {
-    var sty: ToastStyle = ToastManager.shared.style
-//    ToastManager.shared.isQueueEnabled = true
+///   - style: 函数 styleType(:)的参数,返回 ToastStyle
+/// - Returns:
+public func cShowHUB(superView: UIView?, msg: String?, style: Int = 0) {
+    let sty = styleType(style)
     cHiddenHUB(superView: nil)
-    sty.messageAlignment = .center
     DispatchQueue.main.async {
         if superView == nil {
             if msg == nil {