NSThread in Objective-C

I had an issue in my iOS application at work where there was a long pause while the view for a QR reader was initializing. So I decided to use Cocoa’s Activity Indicator to try to give a better user experience. I would show the indicator before the view initialized and hide it on the view’s didAppear delegate method. The Activity Indicator did show up and disappear, however, there was still a long pause (it was as if the Activity Indicator wouldn’t start until the view actually initialized).

I decided to thread out the showing of the Activity Indicator using NSThread:

NSThread* busy = [[NSThread alloc] initWithTarget:self
                                         selector:@selector(showBusy)
                                           object:nil];
[busy start];

Worked perfect!