Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do I need to suffix @3x in UIImage imageNamed?

There are iPhone 6 and iPhone 6 plus device available from apple.

  • I have three pics including @2x and @3x. When I load image using UIImage imageNamed:.
  • Do I need to add @3x ad the end of file? My naming convention is pic.png, [email protected], [email protected].
  • Do I need to do like first check the running device is iPhone 6 and then [UIImage imageNamed:@"[email protected]"] or just [UIImage imageNamed:@"pic"] and the device will automatically use the right image for the right device?
like image 246
yong ho Avatar asked Nov 07 '14 09:11

yong ho


2 Answers

Sol: [UIImage imageNamed:@"pic"] is enough instead of [UIImage imageNamed:@"pic.png"].

Reason:

like image 185
Rajesh Loganathan Avatar answered Nov 19 '22 13:11

Rajesh Loganathan


[UIImage imageNamed:@"pic"]

is enough.

Suffixes (@2x for iPhone 4 to 6 and @3x for iPhone 6 plus) are added automatically if image with this suffix is found.

like image 2
nicael Avatar answered Nov 19 '22 13:11

nicael