2


我有一个TabBarController应用,其中第一tabBarItem是NavigationController ...
编程方式的图像背景分配给navController与此代码:问题的一个视网膜显示图像

self.navigationController.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"OverviewBg.png"]];
的“OverviewBg.png”图像是tabBar和NavBar之间视图的确切大小。
如果我尽我的iPhone 4仿真应用,高清晰度图像不正确加载并显示正常图像...

我怎样才能解决这个错误?使用colorWithPatternImage方法的最佳方式是使用具有视图或图案图像的确切大小的图像?

谢谢

+0

你好。 HD中图像的名称是什么? (请复制粘贴确切的名字^^) – Vinzius 2010-10-04 18:38:26

+3

前段时间我问过类似的东西:基本上是这样的:http://stackoverflow.com/questions/3548794/loading-resources-dynamically-for-iphone-3gs-and-4你需要一个文件[email protected]用于视网膜显示 – nacho4d 2010-10-04 18:41:43

+1

我知道这个...我的视网膜显示图像被命名为[email protected],但它没有正确加载......是否有可能是一个错误colorWithPatternImage方法? – matteodv 2010-10-05 15:17:47

回答

1

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

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

希望这可以帮助其他:)