I’m trying to find a way to display a progress bar with a percentage label during the loading of an UIImage. The label and the progress bar are supposed to show the progress of the loading.
The loading of my image is implemented like that :
NSData* receivedData = [[NSData alloc] initWithContentsOfURL:[NSURL URLWithString:urlImage]];
UIImage* tmp = [UIImage imageWithData:receivedData];
Thanks 🙂
You can’t show any progress using the code you posted. Instead, use an NSURLConnection and do an asynchronous download of the data. You’ll need to look at the initial response and get the file size, then as you get notified about data you can update the progress bar based on the file size and the total amount of data received so far.