Created
January 16, 2013 17:56
-
-
Save seanwolter/4549216 to your computer and use it in GitHub Desktop.
NSOperation queue very basic example
This file contains 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
// MyOperation.h | |
@interface MyOperation : NSOperation | |
@end | |
// MyOperation.m | |
@implementation MyOperation | |
- (void)main { | |
if ([self isCancelled]) { | |
NSLog(@"** operation cancelled **"); | |
} | |
[self performSelectorOnMainThread:@selector(updateUserInterface) withObject:nil waitUntilDone:NO]; | |
} | |
- (void)updateUserInterface { | |
some UI code | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment