开发者

UIButton image and retina display

I have some button with custom background image, and here is how I do this:

UIImage *buttonImage2Normal = [UIImage imageNamed:@"greyButton.png"];

[showModal setBackgroundImage:buttonImage2Normal
                                        forState:UIControlStateNormal];

UIImage *buttonImage2Pressed = [UIImage imageNamed:@"greyButtonPressed.png"];

[showModal setBackgroundImage:butt开发者_StackOverflow社区onImage2Pressed
                                        forState:UIControlStateHighlighted];

And I made four images, greyButton.png, greyButtonPressed.png and @2x versions to support retina.

But, on retina (iPhone simulator) I see ok my buttons, but on iPhone (3G) I think that is uses bigger images because my buttons are almost without rounded corners.

This is the right method for doing this?


You are doing it correctly as long as you name your Retina Display images like this: filename.png and filename@2x.png

You might want to simply test by making a non-Retina image that's a red colour, then a Retina image that's a blue colour.

On iPhone Simulator with Retina scale you should be seeing a blue button and on your 3G iPhone you should be seeing a red button.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜