esreli
esreli

Reputation: 5071

Image Naming Convention Confusion and UIBarButtonItem

I hope this is an easy fix, I just can't seem to wrap my head around one concept.

Of course with the introduction of their retina display, the api has adapted by asking developers to alter the image names for different sizes.

Now I am simply trying to create a UIBarButtonItem using the method initWithImage:style:target:action:

I have created an image named barButtonImage.png with these dimensions: W:20px H:19px. I have also created an image named [email protected] with these dimensions: W:40px H:38px.

I was under the assumption that the API would adapt and scale the image appropriately but when I build and run on my retina device, I am given a UIBarButtonItem that has appropriately scaled the height of the image down to 19px but has kept the 40px width of the image intact so I have a horizontally stretched image fitting inside a wide UIBarButtonItem.

Any suggestions toward what I can do to fix this problem?

Upvotes: 0

Views: 141

Answers (1)

rmaddy
rmaddy

Reputation: 318924

The image needs to be named with @2x, not @2X. iOS filenames on real devices are case sensitive.

Upvotes: 3

Related Questions