Adding PNG to UIImageView with code looks terrible compared to adding it directly in the NIB

StackOverflow https://stackoverflow.com/questions/7155175

  •  08-01-2021
  •  | 
  •  

Question

How do I get the image added to the UIImageView to look the same when added in code as when I add it directly in the NIB?

I have a 5 of clubs picture, in the NIB file I use the Image drop down to select the 5 of clubs picture from the resources. The 5 of clubs looks perfect.

When I use the same resource to add the image to the UIImageVIew using code the image looks terrible. Looks like a terrible resize job.

Here is the code I am using to add the image to the UIImageView.

 uiimg.image = [UIImage imageNamed:@"5clubs.png"];
Était-ce utile?

La solution

You needed to Clean the project and recompile for it to pick up the new image. I had previously a HUGE image with the same name.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top