iosiphoneswiftswift3mbprogresshud

MBProgressHud View Customization Not Work In Swift 3 And Not Showing?


i am using the following code but not showing progress hud so please help for that.simple hud showing fine but customise not showing

let loadingHUD = MBProgressHUD() 

loadingHUD.mode = MBProgressHUDModeCustomView
loadingHUD.labelText = nil
loadingHUD.detailsLabelText = nil
let customView = UIView.init(frame: CGRect(x: 0, y: 0, width: 80, height: 80))

let gifmanager = SwiftyGifManager(memoryLimit:20)
let gif = UIImage(gifName: "miniballs1.gif")
let imageview = UIImageView(gifImage: gif, manager: gifmanager)
imageview.frame = CGRect(x: 0 , y: 0, width: customView.frame.width, height: customView.frame.height)
customView.addSubview(imageview)
customView.bringSubview(toFront: imageview)

loadingHUD.customView = customView
loadingHUD.customView.bringSubview(toFront: customView)
loadingHUD.show(true)

Solution

  • Try with this library ACProgressHud-Swift

    In xib file whatever view make then customise and use it.

    For Show

    ACProgressHUD.shared.showHUD(withStatus: “Your Message Name“)
    

    For hide

    ACProgressHUD.shared.hideHUD()