Display local image in UIImageView Display local image in UIImageView ios ios

Display local image in UIImageView


To load image from somewhere on your drive use:

UIImage * myImage = [UIImage imageWithContentsOfFile: @"../images/1.png"];

Or add image to the Xcode project and use:

UIImage * myImage = [UIImage imageNamed: @"1.png"];

After that add image to imageview:

UIImageView * myImageView = [[UIImageView alloc] initWithImage: myImage];


You dont need to give any path as long as the image is in your resources folder.

You can display that image in the imageView using this.

yourImageView.image = [UIImage imageNamed:@"something.png"];


UIImage *img = [UIImage imageWithContentsOfFile:(the file path)];UIImageView *imgView = [[UIImageView alloc] initWithImage:img];

check the docs for imageWithContentsOfFile: