0
我使用代码来调用的方法和显示HUD如下时将显示对话框,选择方法无法完成
HUD = [[MBProgressHUD alloc] initWithView:self.view];
[self.view addSubview:HUD];
HUD.delegate = self;
HUD.labelText = @"Signing you up";
// myProgressTask uses the HUD instance to update progress
[HUD showWhileExecuting:@selector(processFieldEntries) onTarget:self withObject:nil animated:YES];
我有一些错误检查,然后显示一个对话框processFieldEntries内删除MBProgressHUD。如下图所示:
showDialog:
if (textError) {
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:errorText message:nil delegate:self cancelButtonTitle:nil otherButtonTitles:@"Ok", nil];
[alertView show];
return;
}
然后,这会导致系统崩溃,可能是因为他们都在同一个线程,没有从视图中删除的HUD。
我的问题是我应该添加不同的代码以确保它们在不同的线程上运行?我应该添加到processFieldEntries方法,然后删除HUD,因为它被称为showWhileExecuting ...