views:

96

answers:

1

Hi all,
I have a TabBarController app where the first tabBarItem is a NavigationController...
I assign programmatically an image background to the navController with this code:

self.navigationController.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"OverviewBg.png"]];
The "OverviewBg.png" image is the exact size of the view between tabBar and NavBar.
If I try my app in the iPhone 4 simulator, the high definition image isn't loaded correctly and is showed the normal image...

How can I solve this mistake? The best way to use colorWithPatternImage method is use an image with the exact size of the view or a pattern image?

Thanks

A: 

I solved this problem using initWithPatternImage method of UIColor class.
I created and allocated an UIColor instance, I assigned to it an image and then I used it with background.

UIColor *background = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"OverviewBg.png"]];
self.navigationController.view.backgroundColor = background;

Hope this can help other :)

Matthew