取image方法1
UIImage *image = [UIImageimageNamed:@"图片名字"];//没有 @2x @3x
输出:
2015-06-01 16:30:33.219 test[4676:1829040] device: iPhone 4s *** imageData.length: 1107
2015-06-01 16:29:30.001 test[4617:1819270] device: iPhone 5 *** imageData.length: 1107
2015-06-01 16:27:57.803 test[4535:1810875] device: iPhone 5s *** imageData.length: 1107
2015-06-01 16:25:45.310 test[4476:1798634] device: iPhone 6 *** imageData.length: 1107
2015-06-01 16:33:11.060 test[4751:1848019] device: iPhone 6 Plus *** imageData.length: 1840
取image方法2
NSString *path = [[NSBundlemainBundle]pathForResource:@"图片名字"ofType:@"png"];//没有 @2x @3x
UIImage *image = [[UIImagealloc]initWithContentsOfFile:path];
2015-06-01 16:50:09.486 test[5168:1954713] device: iPhone 4s *** imageData.length: 1107
2015-06-01 16:49:44.608 test[5116:1951056] device: iPhone 5 *** imageData.length: 1107
2015-06-01 16:44:16.885 test[4974:1921579] device: iPhone 5s *** imageData.length: 1107
2015-06-01 16:45:40.441 test[5032:1932897] device: iPhone 6 *** imageData.length: 1107
2015-06-01 16:42:36.905 test[4920:1907182] device: iPhone 6 Plus *** imageData.length: 1840
通过测试 可以发现两种方法在iPhone 6 Plus 上都会优先加载 @3x 图片,在其他测试机型上加载 @2x 图片。