Image unrecognized ios

31 Views Asked by At

I have an UIImage that I assign to an UIImageView.

When I do :

UIImage *picto = [UIImage imageNamed:@"animage.png"];
UIImageView *imageView1 = [[UIImageView alloc] initWithImage:picto];

it works, but when I do :

UIImage *picto = [UIImage imageNamed:@"animage2.png"];
UIImageView *imageView1 = [[UIImageView alloc] initWithImage:picto];

My image 2 isn't displayed, the grammar is correct and my image exist in the project...

By the way, the second image is not displayed just because it name

1

There are 1 best solutions below

1
On BEST ANSWER

use this format :

UIImageView *icon_bg=[[UIImageView alloc]init];
icon_bg.image=[UIImage imageNamed:@"animage.png"];
[Cell.contentView addSubview:icon_bg];