Last active
December 10, 2015 13:28
-
-
Save ChrisRisner/4441051 to your computer and use it in GitHub Desktop.
iOS Day 28
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
- (void)backgroundDone { | |
NSLog(@"Done"); | |
} |
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
- (void)backgroundDone { | |
NSLog(@"Done"); | |
[self.indicator stopAnimating]; | |
} |
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)tappedProcessStuff:(id)sender { | |
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{ | |
NSLog(@"Start"); | |
//Do EXTREME PROCESSING!!! | |
for (int i = 0; i< 100; i++) { | |
[NSThread sleepForTimeInterval:.05]; | |
NSLog(@"%i", i); | |
} | |
dispatch_async(dispatch_get_main_queue(), ^{ | |
[self backgroundDone]; | |
}); | |
}); | |
} |
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)tappedProcessStuff:(id)sender { | |
[self.indicator startAnimating]; | |
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{ | |
NSLog(@"Start"); | |
//Do EXTREME PROCESSING!!! | |
for (int i = 0; i< 100; i++) { | |
[NSThread sleepForTimeInterval:.05]; | |
NSLog(@"%i", i); | |
} | |
dispatch_async(dispatch_get_main_queue(), ^{ | |
[self backgroundDone]; | |
}); | |
}); | |
} |
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)tappedProcessStuff:(id)sender { | |
[self.indicator startAnimating]; | |
[UIApplication sharedApplication].networkActivityIndicatorVisible = TRUE; | |
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{ | |
NSLog(@"Start"); | |
//Do EXTREME PROCESSING!!! | |
for (int i = 0; i< 100; i++) { | |
[NSThread sleepForTimeInterval:.05]; | |
NSLog(@"%i", i); | |
dispatch_async(dispatch_get_main_queue(), ^{ | |
[self updateProgressBar:i]; | |
}); | |
} | |
dispatch_async(dispatch_get_main_queue(), ^{ | |
[self backgroundDone]; | |
}); | |
}); | |
} |
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
- (void)updateProgressBar:(int)count { | |
float progress = count/100.0; | |
[self.progressBar setProgress:progress]; | |
} |
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
@interface ViewController : UIViewController | |
- (IBAction)tappedProcessStuff:(id)sender; | |
@end |
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
@interface ViewController : UIViewController | |
- (IBAction)tappedProcessStuff:(id)sender; | |
@property (weak, nonatomic) IBOutlet UIActivityIndicatorView *indicator; | |
@end |
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
@interface ViewController : UIViewController | |
- (IBAction)tappedProcessStuff:(id)sender; | |
@property (weak, nonatomic) IBOutlet UIActivityIndicatorView *indicator; | |
@property (weak, nonatomic) IBOutlet UIProgressView *progressBar; | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment