SetBackgroundImage forBarMetrics image size?

I am new to iOS programming and I am creating my first application. I am trying to use the following code to change the background image of the navigation bar (this uses the new iOS 5 method):

[self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"gradientBackgroundPlain.png"] forBarMetrics: UIBarMetricsDefault]; 

It works fine, but my image is 640 x 88 and it looks too big for a bar. Is it like the system doesn't want to scale it, or do I need to do this manually? If I scale the image and create a smaller one, it looks uneven on the retina screen.

Any thoughts on this?

Any help or response would be appreciated.

Thanks,

Jorge .-

+8
ios objective-c uinavigationbar
source share
1 answer

Your gradientBackgroundPlain.png image should be 320x44 and create a second image named gradientBackgroundPlain@2x.png with a size of 640x88. Include the @ 2x image in your kit, but keep specifying gradientBackgroundPlain.png for the image name. The platform automatically selects the correct image size for use depending on whether or not a retina display is available.

+18
source share

All Articles