Reputation: 223
I have a submit button on my view controller which I'd like to..
The code I have so far..
- (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];
}
With this I don't see the MBProgressHUD at all. If I comment out the performSegueWithIdentifier I do. Please help.
Upvotes: 0
Views: 593
Reputation: 3444
you can do this with NSTimer
try this code
-(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];
}
with 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];
});
Upvotes: 2