views:

189

answers:

1

I have a IBAction that looks like this:

self.title = @"Logging in ...";
[MyClass myLongRunningOperation];

My Problem is that the view controller title does not get updated until the long running operation has finished. It seems like its put in a queue for later, while my long running operation executes right away.

I'm pretty new to the plattform, so forgive my ignorance here.

Thanks, -- Felix

+3  A: 

You're blocking the UI thread. Consider using

[self performSelectorOnBackgroundThread:@selector(doLongRunningOperation) withObject:nil];

You probably really want to read the Threading Programming Guide at some point.

David Maymudes
Also: http://developer.apple.com/cocoa/managingconcurrency.html (Talks about using NSOperation to manage concurrency rather than dealing with threads directly)
Malaxeur
Thanks a ton. I'll definitely look into the threading guide!
felixge