imageWithContentsOfFile:
Creates and returns an image object by loading the image data from the file at the specified path.
+ (UIImage *)imageWithContentsOfFile:(NSString *)path
Parameters
- path
- The full or partial path to the file.
Return Value of [UIImage imageWithContentsOfFile]
A new image object for the specified file, or
nil
if the method could not initialize the image from the specified file.Discussion of [UIImage imageWithContentsOfFile]
This method does not cache the image object.
Example of [UIImage imageWithContentsOfFile]
UIImage *temp_img = [UIImage imageNamed:@"temp.png"];
vs.
NSString *imagePath = [[NSBundle mainBundle] pathForResource:@"temp.png" ofType:nil]; UIImage *temp_img =[UIImage imageWithContentsOfFile :imagePath];