I have an application that uses objects UIImage. Until now, I used image objects initialized with something like this:
UIImage *image = [UIImage imageNamed:imageName];
using the image in my application. I am adding functionality that allows users to use images from the camera or their library using UIImagePickerController. Obviously, these images cannot be in my application, so I initialize the object in a UIImagedifferent way:
UIImage *image = [UIImage imageWithContentsOfFile:pathToFile];
This is done after the first resizing of the image to a size similar to other files in my application suite, both in pixel sizes and in total bytes, both using the Jpeg format (interestingly, PNG was much slower even for the same file size) . In other words, the file pointed pathToFileto is a file with the same size as the image in the packet (matching pixel sizes and compression, so the number of bytes was the same).
The application goes through a cycle that creates small fragments from the original image, among other things that are not related to this message. My problem is that going through a loop using the created image the second way takes much longer than using the image created in the first way.
, , , , , . , ?
, , :
[image drawInRect:self.imageSquare]
self UIImageView. imageSquare - CGRect, , . . , UIImage object?
-, -, ?
EDIT: imageWithContentsOfFile, 4 . , , , imageNamed, .