我创建了一个应用程序,我在其中创建了一个 UIProgressBarHUD 来显示正在加载的东西。我的问题是,如何禁用视图,以便在加载完成之前无法按下任何内容?
我试过设置:
[self.view setUserInterationEnabled:NO];
但是这不起作用:/
这是我用于添加 UIProgressHUD 的代码:
- (IBAction) showHUD:(id)sender
{
//[self.view setUserInteractionEnabled:NO];
UIProgressHUD *HUD = [[UIProgressHUD alloc]
initWithWindow:[[UIApplication sharedApplication] keyWindow]];
[HUD setText:@"Loading…"];
[HUD show:YES];
[HUD performSelector:@selector(done) withObject:nil afterDelay:1.5];
[HUD performSelector:@selector(setText:) withObject:@"Done!"
afterDelay:1.5];
[HUD performSelector:@selector(hide) withObject:nil afterDelay:4.0];
//[self.view setUserInteractionEnabled:YES];
[HUD release];
}
任何帮助将不胜感激!- 詹姆士