我有这样的代码的iOS UIAlertView中显示和处理顺序
- (IBAction)save:(id)sender {
self.imageView.image = [UIImage imageNamed:@"loading.gif"];
[self.view setUserInteractionEnabled:NO];
MBProgressHUD *hudSave = [MBProgressHUD showHUDAddedTo:self.navigationController.view animated:YES];
hudSave.labelText = @"Saving...";
NSLog(@"save");
UIAlertView *deco;
if (!isVideo) {
UIImageWriteToSavedPhotosAlbum (imageView.image, nil, nil , nil);
deco = [[UIAlertView alloc]initWithTitle:@"Save" message:@"Your photo has been saved." delegate: nil cancelButtonTitle:@"oK" otherButtonTitles:nil];
}else{
//UIAlertView *explain;
//explain = [[UIAlertView alloc]initWithTitle:@"Wait during processing" message:@"Your video is being filtered, this process may be long, depending of both video and device. Please do not close this app until task is finished." delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil];
UIAlertView *explain;
explain = [[UIAlertView alloc]initWithTitle:@"Wait during processing" message:@"Your video is being filtered, this process may be long, depending of both video and device. Please do not close this app until task is finished." delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil];
[explain show];
[self InitialisationRefiltrage:urlVideo];
//[self InitialisationRefiltrage:urlVideo];
deco = [[UIAlertView alloc]initWithTitle:@"Save" message:@"Your video has been saved." delegate: nil cancelButtonTitle:@"Ok" otherButtonTitles:nil];
}
[MBProgressHUD hideHUDForView:self.navigationController.view animated:YES];
[deco show];
[self.view setUserInteractionEnabled:YES];
}
问题的部分是,如果我的文件是一个视频,它会直接太“initialisationRefiltrage”(谁是工作的罚款),但没有显示MBProgressHUD和警报视图解释,并在我的视频traitement后,它显示一切(解释,装饰,和MBProgressHUD)在同一时间。
我尝试一些派遣,线程等......但我认为一个不正确的做法,所以你可以给我一个线索,如何做到这一点。
祝您有愉快的一天。
你的子类很好地解决了我的问题,所以非常感谢你。现在我的警报和进度条都在顺畅且节奏地运行。我也修改函数的名称,通常我尊重编码惯例我不知道为什么不在这里,也许我很累,或者可能是复制粘贴我不检查好我不记得^^ – Arfost