Is UIImage -imageNamed: a method for working with image files stored in Documents?

My application is downloading a small image file from a remote server and I am trying to display it along with some other small image files that are pre-installed in the application. I am using [UIImage imageNamed: @ "TheImageName.png"] to get images (see below for details). The pre-installed images appear as expected, but the image in the Documents folder of my applications does not exist. Should I use -imageNamed for the image in Documents, or some other method?

UIImage* documentsImage = [UIImage imageNamed:@"TheImageName.png"];
UIImageView* anImageView = [[UIimageView alloc] initWithImage:documentsImage];
[self.view addSubview:anImageView];

      

+2


source to share


2 answers


Ah, never mind. I found that using [UIImage imageWithContentsOfFile: filePath] works for this. imageNamed just returns nil.



+2


source


No, it +imageNamed:

only downloads images from the app bundle.



Also, do not use extension .png

when using this class method.

+2


source







All Articles