9

是否可以在 MBProgressHUD 叠加层中加载自定义视图,MBProgressHUD 类有一个自定义视图选项,但是我可以使用 customView 分配一个 XIB 视图等吗?

4

1 回答 1

11

是的,你可以这样做:

MBProgressHUD *loadingHUD = [[MBProgressHUD alloc] init];
loadingHUD.mode = MBProgressHUDModeCustomView;
loadingHUD.labelText = nil;
loadingHUD.detailsLabelText = nil;
UIView *customView = [[UIView alloc] initWithFrame:self.view.bounds]; // Set a size
// Add stuff to view here
loadingHUD.customView = customView;
[HUD show:YES];
于 2012-08-21T11:56:38.843 回答