我的视图控制器上有一个提交按钮,我想...
到目前为止我的代码..
- (IBAction)submit:(id)sender
{
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
[hud setMinShowTime:3];
[hud setLabelText:@"Processing"];
[hud hide:YES];
[self performSegueWithIdentifier:@"showAuditViewControllerBravo" sender:self];
}
有了这个,我根本看不到MBProgressHUD。如果我注释掉performSegueWithIdentifier,我会这样做。请帮忙。
答案 0 :(得分:2)
您可以使用 NSTimer
执行此操作试试这段代码
-(void)stopAnimationAndMove{
[MBProgressHUD hideAllHUDsForView:self.view animated:YES];
[self performSegueWithIdentifier:@"showAuditViewControllerBravo" sender:self];
}
- (void)viewDidLoad
{
[super viewDidLoad];
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
[hud setMinShowTime:3];
[hud setLabelText:@"Processing"];
[NSTimer scheduledTimerWithTimeInterval:3.0
target:self
selector:@selector(stopAnimationAndMove)
userInfo:nil repeats:NO];
}
dispatch_after
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
[hud setLabelText:@"Progress"];
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, 3.0 * NSEC_PER_SEC); // provide value as required. time here is 3 sec
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
[MBProgressHUD hideHUDForView:self.view animated:YES];
[self performSegueWithIdentifier:@"showAuditViewControllerBravo" sender:self];
});