Position MBProgressHUD at the Bottom/Top of the screen

前端 未结 5 1130
醉话见心
醉话见心 2020-12-17 21:28

Is there a way to make the MBProgressHUD show at the bottom or top of the screen?

I have tried setting the frame using [hud setFrame:....];, initW

5条回答
  •  無奈伤痛
    2020-12-17 22:03

    We can change position of MBProgressHUD via change in yOffset and xOffset. Below line of code is for place MBProgressHUD at bottom.

    let hud = MBProgressHUD.showAdded(to: view, animated: true)
    hud?.mode = .text
    hud?.labelText = json!["message"] as! String
    hud?.yOffset = Float(view.frame.size.height*2/5);
    hud?.removeFromSuperViewOnHide = true
    hud?.margin = 10.0
    hud?.hide(true, afterDelay: 2)
    

提交回复
热议问题