我想在3月16日新iPad发布时将iPad视网膜(超赞!)质量的图像放入我的应用程序中。然而,我无法在文档中找到正确的文件名后缀!
我在iPhone和iPod视网膜显示器上使用@2x后缀。如果其他人知道iPad的后缀是什么,并且更重要的是,能够向我展示官方文件的链接,我将不胜感激。
谢谢! :-D
额外信息:
我想留下一些代码,我开始使用iPhone @2x图像以替换iPad非视网膜图像(因为我的大多数@2x~iphone和~ipad图像是相同的,重复只是浪费空间)。
+ (UIImage*)imageNamedSmart:(NSString*)name
{
UIImage *returnImage = [UIImage imageNamed:[NSString stringWithFormat:@"%@", name]];
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
{
if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)] && [[UIScreen mainScreen] scale] == 2)
{
// iPad Scale 2 i.e. 3rd Gen iPad
}
else
{
// iPad Scale 1 i.e. 1st and 2nd Gen iPad
return [UIImage imageNamed:[NSString stringWithFormat:@"%@@2x", name]];
}
}
return returnImage;
}
这意味着不再调用:[UIImage imageNamed:@"imageName"]
而是调用:
[self imageNamedSmart:@"imageName"]
希望这能对人们有所帮助。 :-D
(我通过谷歌搜索找到了这个想法,但是我找不到原始站点链接,所以无论你是谁,谢谢你。)
imageNamed:
已经为您完成了所有的工作。它知道所有4个分辨率和前缀。;-) - Constantino Tsarouhas