Hi Forum,
I currently have a NSData object from a URL. The code is as follows:
now I would like to cache this image file and for that I would have to get the path via NSFileManager...etc etc..Then eventually use the method
from NSData class
now this image is a JPEG...so what is the difference between the following.
and
is there a difference between whats in the NSDATA object "data" and the NSData object that the function from UIKIT: NSData * UIImageJPEGRepresentation (
UIImage *image,
CGFloat compressionQuality
); returns??
I currently have a NSData object from a URL. The code is as follows:
Code:
NSData *data = [[NSData alloc] initWithContentsOfURL: ImageURL];
now I would like to cache this image file and for that I would have to get the path via NSFileManager...etc etc..Then eventually use the method
Code:
- (BOOL)writeToFile:(NSString *)path atomically:(BOOL)flag
now this image is a JPEG...so what is the difference between the following.
Code:
NSData *data = [[NSData alloc] initWithContentsOfURL: ImageURL];
[data writeToFile: uniquePath atomically: YES];
and
Code:
NSData *data = [[NSData alloc] initWithContentsOfURL: ImageURL];
UIImage *image = [[UIImage alloc] initWithData: data];
[UIImageJPEGRepresentation(image, 100) writeToFile: uniquePath atomically: YES];
is there a difference between whats in the NSDATA object "data" and the NSData object that the function from UIKIT: NSData * UIImageJPEGRepresentation (
UIImage *image,
CGFloat compressionQuality
); returns??