簡體   English   中英

iOS - MBProgressHUD bezelView 透明

[英]iOS - MBProgressHUD bezelView to be transparent

我正在使用 MBProgressHUD 並想讓 bezelView 變得透明。

import UIKit
import MBProgressHUD

class ProgressBarManager {
   func showProgressBar() {
    guard let testView = UIApplication.shared.windows.last else { return }        
    let hud = MBProgressHUD.showAdded(to: testView, animated: true)

    hud.bezelView.layer.cornerRadius = 5
    hud.bezelView.backgroundColor = .clear
    hud.backgroundView.style = .solidColor
    hud.backgroundView.color = UIColor(white: 0, alpha: 0.3)

 }
}

然而 bezelView 仍然顯示:

在此處輸入圖片說明

有沒有辦法隱藏它?

為您的hud初始化代碼添加這一行:

hud.bezelView.style = .solidColor

在 HUD init 之后,設置它:

hud.bezelView.style = .solidColor
hud.bezelView.color = .clear

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM