How to write a sort operation that can handle back event in navigationconroller?
How can I write a sort operation or another operation that doesn't stop to handle my touch events? For example, when I touch Back in UINavigationController, the app immediately goes back and releases the UIViewController.
Answers
Just put your sort operation into the background:
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0), ^(void) { // you sort operation here dispatch_async(dispatch_get_main_queue(), ^(void) { // you updated UI operation here }); });
Then you can release other code, but be careful to touch something outside