DevTip: Abuse threads
Sometimes your interfaces can become clunky. You hit a button, or slide a slider and things get all stuttery. No good. People hate that and so should you. Usually this is because when your control (button, slider, tab, etc) calls back to your handler, there is too much work going on.
Just start a new thread. This sounds simple, but sometimes people over look it. I ran into this when I was adding the volume control on the new audio stream player for MLB.com At Bat. I thought, yeah, no problem, I can make a call to the audio session and store the value in my user defaults in real time. Easy! But no, it made the volume control sticky, so I had to spawn threads. See below.
In Interface Builder, connect your control to your handler for the given event the IBAction below, and then in that method, start a thread and don’t wait around for the result.
- (void) threadedTargetMethod:(id)object {
//Do you time consuming stuff
}
- (IBAction) targetMethod:(id)sender {
[self performSelectorOnMainThread:@selector(threadedTargetMethod:)
withObject:nil
waitUntilDone:NO];
}