Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (IBAction)syncOnThreadAction:(id)sender
- {
- [self willStartJob];
- id myObject = [MyObjectClass createNewObject];
- [self performSelectorInBackground:
- @selector(inThreadStartDoJob:)
- withObject:myObject
- ];
- }
- - (void)inThreadStartDoJob:(id)theJobToDo
- {
- NSAutoreleasePool * pool;
- NSString * status;
- pool = [[NSAutoreleasePool alloc] init];
- assert(pool != nil);
- status = [theJobToDo countGrainsOfSandOnBeach];
- [self performSelectorOnMainThread:
- @selector(didStopJobWithStatus:)
- withObject:status
- waitUntilDone:NO
- ];
- [pool drain];
- }
- -(void)submit_Clicked:(id)event
- {
- [self.spinner startAnimating];
- [self performSelector:@selector(displayComposerSheet)
- withObject:nil afterDelay:0];
- }
- 1> Have 1 method that starts the spinner (in the background).
- 2> Run your long-running code right here.
- 3> Have 1 method that ends the spinner.
- A> Have 1 method that starts the spinner.
- B> Have 20 methods (1 for each thing you want to do in the background)
- C> Have 1 method that ends the spinner.
Add Comment
Please, Sign In to add comment