0
`UIWindow *tempKeyboardWindow = [[[UIApplication sharedApplication] windows]objectAtIndex:0];


MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:tempKeyboardWindow animated:YES];

hud.animationType = MBProgressHUDAnimationZoomOut;

hud.dimBackground = YES;

hud.labelText = showString;

`

我需要将 hud 添加到我的应用程序窗口中,所以我使用了上面的代码但没有工作。有人可以帮助我吗?

4

1 回答 1

1

首先你需要分配初始化它,如下所示

self.progressHud = [[MBProgressHUD alloc]initWithView:self.navigationController.view];

然后设置它的必需属性如下

self.progressHud.labelText = @"Processing Image";
self.progressHud.dimBackground = YES;
self.progressHud.animationType = MBProgressHUDAnimationZoom;
self.progressHud.delegate = self;

然后为了显示它使用下面的代码

[self.navigationController.view addSubview:self.progressHud];
[self.progressHud show:NO];
于 2012-12-31T11:15:14.293 回答