Breno Gazzola
Breno Gazzola

Reputation: 2162

Problems with @2x images for IOS5 and Xcode 4.3

I've been looking for a couple of hours for answers for this problem on both Google and Stackoverflow, and none of the suggestions worked so far, so maybe one of you can tell me what's the problem.

Here's exactly what I'm doing, step by step:

  1. Create a 44x44 red square image (test.png) and a 88X88 green square image ([email protected])
  2. Drag both images to a folder named "Resources" inside my Xcode project
  3. Insert the following code inside the controller's viewWillAppear method

    UIImage *navigationBackground = [[UIImage imageNamed:@"test.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0)];
    [self.navigationController.navigationBar setBackgroundImage:navigationBackground forBarMetrics:UIBarMetricsDefault];
    

After the application is launched on the simulator (iOS 5.1), the bar has a red background, which means that iOS loaded the low resolution image, not the high resolution one.

What am I doing wrong here? Am I missing a step? Do I have to change the plist file?

Thanks

Upvotes: 0

Views: 198

Answers (1)

svena
svena

Reputation: 2779

The simulator is by default in non-retina mode. Make sure you choose iPhone (Retina) from Hardware/Device menu.

I cannot see anything obviously wrong in your posted code.

Upvotes: 1

Related Questions