我想創建一個兼容視網膜和非視網膜顯示器的應用程序。我正在使用高分辨率圖像,並讓操作系統縮小非視網膜顯示器的尺寸。質量差的UIImages
圖像被命名爲[email protected],我用相同的名稱加載。這可以工作,並且圖像在兩種設備類型上以相同的相對大小顯示。不幸的是,在非視網膜顯示器上調整大小的圖像的質量遠非理想。
self.navigationItem.rightBarButtonItem.image = [localAssets imageAtPath:@"content/home/[email protected]"];
+ (UIImage*)imageAtPath:(NSString*)path;
{
NSString* extension = [path pathExtension];
path = [path stringByDeletingPathExtension];
NSString* filePath = [[NSBundle mainBundle] pathForResource:[path lastPathComponent]
ofType:extension
inDirectory:[path stringByDeletingLastPathComponent]];
UIImage* theImage = [UIImage imageWithContentsOfFile:filePath];
if(!theImage)
{
NSLog(@"Error no file found at %@", [path stringByAppendingPathExtension:extension]);
}
return theImage;
}
視網膜:
遺產:
發佈您的代碼。 – coneybeare 2012-07-05 20:17:08