IOS - MBProgressHUD设置自定义背景图像

时间:2015-05-30 10:17:38

标签: ios objective-c mbprogresshud

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

I want to set custom my application's suitable background image in place of Black color

2 个答案:

答案 0 :(得分:3)

如果您阅读了头文件,您会看到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并将其传递给您在调用之前创建的HUD .show

答案 1 :(得分:1)

尝试使用此代码设置图像

hudProgress.color =[UIColor colorWithPatternImage:[UIImage imageNamed:@"yourBackground.png"]]
相关问题