Reputation: 16051
I have 3 short questions, very related:
How do i detect if the user is using a retina device?
I want to save an image inside my app in documents, if i detect that they're using a retina display phone and save the image ending in @2x.jpg
will it work as it does with imported images, where it'll automatically go for that one instead on a retina device?
If i were to reference an image which didn't exist, but a @2x.jpg
version existed, would it go to that by default?
Upvotes: 0
Views: 1285
Reputation: 10251
[UIScreen mainScreen].scale
, it's 2.f
when it's a retina screen.@2x
-versions here too (as long as you use UIImage
to load them).@2x
-version first, if it doesn't exist, it'll fallback to the default-version. If that version doesn't exist, it'll return nil
. A non retina screen however, will never look to the @2x
-version.You call it a x2.jpg
-file, however, it isn't:
background.png
.[email protected]
.UIImage *image = [UIImage imageNamed:@"background.png"];
.Upvotes: 5