【问题标题】:IOS - MBProgressHUD set Custom Background imageIOS - MBProgressHUD 设置自定义背景图片
【发布时间】:2015-05-30 10:17:37
【问题描述】:

默认情况下,MBProgressHUD 带有黑色背景色。我知道如何将此颜色更改为蓝色或绿色等。但是是否可以在 MBProgressHUD 的背景中设置 自定义背景图像

【问题讨论】:

    标签: ios objective-c mbprogresshud


    【解决方案1】:

    如果您阅读头文件,您会看到 HUD 的状态以及设置自定义视图的方法。

    /**
    * The UIView (e.g., a UIImageView) to be shown when the HUD is in MBProgressHUDModeCustomView.
    * For best results use a 37 by 37 pixel view (so the bounds match the built in indicator bounds). 
    */
    @property (MB_STRONG) UIView *customView;
    

    所以您需要创建一个自定义 UIView 并将其传递给您在调用 .show 之前创建的 HUD

    【讨论】:

      【解决方案2】:

      试试这个代码来设置图片

      hudProgress.color =[UIColor colorWithPatternImage:[UIImage imageNamed:@"yourBackground.png"]]
      

      【讨论】:

        猜你喜欢
        • 2011-03-24
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-03-15
        • 2018-07-15
        相关资源
        最近更新 更多