Download asynchronous iphone file?

Is there a way to download local files in asynchronous iphone mode? I load uiimages for my uitableview using this:

NSData *imageData = [[NSData alloc] initWithContentsOfFile:fileName];
UIImage *cachedImage = [[[UIImage alloc] initWithData:imageData] autorelease];

but it is slow because the main thread is blocked or something else until NSData finishes downloading the file and the user interface stops responding. Is there something like NSURLConnection, but for local files? So I can just download the file without the user interface freezing, and when it finishes downloading, some kind of handler sends a notification or something like that.

+2
source share
1 answer

NSOperationQueue NSInvocationOperation . "performSelectorOnMainThread" . . http://gist.github.com/375559.

+3

Source: https://habr.com/ru/post/1770147/


All Articles