Created
October 3, 2012 02:04
-
-
Save raulriera/3824516 to your computer and use it in GitHub Desktop.
Load iPhone5 retina graphics
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Assuming you have the images following images, this should work fine | |
// images/[email protected] | |
// images/[email protected] | |
require("ImageHelper"); | |
var window = Titanium.UI.createWindow({ | |
title: "My awesome window", | |
backgroundImage: parse568hImages("/images/background.png") | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// I am pretty sure there is a sexier approach, but this works nicely | |
var isPhone5 = Ti.Platform.displayCaps.platformHeight == 568; | |
parse568hImages = function(imagePath) { | |
if (isPhone5){ | |
// Do this because the filename could contain dots | |
imagePath = imagePath.replace(".png","[email protected]"); | |
imagePath = imagePath.replace(".jpg","[email protected]"); | |
imagePath = imagePath.replace(".jpeg","[email protected]"); | |
} | |
return imagePath; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You could use: