When displaying image included in the project in .png
format using UIImageView
to only display the simulator screen is left blank
Code used:
UIImage* imagemLocal = [UIImage imageNamed:@"button.png"];
_imagemViewLocal = [UIImageView alloc]initWithImage:imagemLocal];
Or:
UIImage* imagemLocal = [UIImage imageNamed:@"button.png"];
_imagemViewLocal = [[UIImageView alloc]init];
[_imagemViewLocal setImage: imagemLocal];
The result is the same ImageViewLocal
is left blank.
NOTE: I added UIImageView
to Sotryboard
and I connected it with _imageViewLocal
.
I just completed the following test:
- I removed the UIImageView
created in Storyboard
and did everything directly in the code. And displayed the image with the following code:
UIImageView* imageViewLocal = [[UIImageView alloc]init];
imagemLocal = [UIImage imageNamed:@"button.png"];
imageViewLocal = [[UIImageView alloc]initWithImage:imagemLocal];
[self.view addSubview: imageViewLocal];
How to solve the reported problem?