Created
March 6, 2012 01:02
-
-
Save BenBarahona/1982591 to your computer and use it in GitHub Desktop.
MBProgress HUD determinate
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - (IBAction)showWithLabelDeterminate:(id)sender { | |
| HUD = [[MBProgressHUD alloc] initWithView:self.navigationController.view]; | |
| [self.navigationController.view addSubview:HUD]; | |
| // Set determinate mode | |
| HUD.mode = MBProgressHUDModeDeterminate; | |
| HUD.delegate = self; | |
| HUD.labelText = @"Loading"; | |
| // myProgressTask uses the HUD instance to update progress | |
| [HUD showWhileExecuting:@selector(myProgressTask) onTarget:self withObject:nil animated:YES]; | |
| } | |
| - (void)myProgressTask { | |
| // This just increases the progress indicator in a loop | |
| float progress = 0.0f; | |
| while (progress < 1.0f) { | |
| progress += 0.01f; | |
| HUD.progress = progress; | |
| usleep(50000); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment