【发布时间】:2013-12-26 08:05:50
【问题描述】:
我正在尝试自定义我的应用的 UI 外观。我使用了以下代码,在非 iPhone5 和后续产品(以及非视网膜显示器)上运行良好,在模拟器上看起来很棒。 但在我的 iPhone5 上它没有加载图像。
-(void)customizeAppearance
{
UIImage* blueBG = [UIImage imageNamed:@"menubar.png"];
[[UINavigationBar appearance] setBackgroundImage:blueBG forBarMetrics:UIBarMetricsDefault];
UIImage* blueBack = [UIImage imageNamed:@"back.png"];
[[UIBarButtonItem appearance] setBackButtonBackgroundImage:blueBack forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
UIImage* blueTabBG = [UIImage imageNamed:@"tabbar-active.png"];
[[UITabBar appearance] setBackgroundImage:blueTabBG];
我怎样才能像这样有条件地加载资源
if(___IPHONE5ORLATER)
load retina images
else
load non retina images
【问题讨论】:
-
您应该改用图像命名约定;你的圣经在这里:developer.apple.com/library/ios/documentation/iphone/conceptual/….
标签: ios xcode ios-simulator retina-display