2


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

4

1 回答 1

1

我使用 UIColor 类的 initWithPatternImage 方法解决了这个问题。
我创建并分配了一个 UIColor 实例,我为它分配了一个图像,然后我将它与背景一起使用。

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

希望这可以帮助其他人:)

于 2010-10-05T16:33:20.770 回答