`UIWindow *tempKeyboardWindow = [[[UIApplication sharedApplication] windows]objectAtIndex:0];
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:tempKeyboardWindow animated:YES];
hud.animationType = MBProgressHUDAnimationZoomOut;
hud.dimBackground = YES;
hud.labelText = showString;
`
我需要将hud添加到我的应用程序窗口,所以我使用上面的代码但没有work.can任何人帮助我吗?
答案 0 :(得分:1)
首先你需要分配init,如下所示
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];