Skip to content

Instantly share code, notes, and snippets.

@ardiwine
Created May 6, 2015 13:57
Show Gist options
  • Save ardiwine/aa84285c3872a177ee68 to your computer and use it in GitHub Desktop.
Save ardiwine/aa84285c3872a177ee68 to your computer and use it in GitHub Desktop.
Image container to fit in the view port appropriately
var imageContainer = Ti.UI.createView({
left: 0,
right: 0,
height: 155, // define the height of each image "row"
clipMode: OS_IOS ? Ti.UI.iOS.CLIP_MODE_ENABLED : null, // iOS specific clipMode property that needs to be enabled
backgroundColor: '#FFFFFF'
});
imageContainer.add(Ti.UI.createImageView({
image: utilities.getFirstImage(args.news.description),
width: Ti.UI.SIZE,
height: 0.5 * Alloy.Globals.screenHeight // Alloy.Globals.screenHeight is the screen height of the device. I set this one globally.
}));
$.row.add(imageContainer); // $.row is the table row where you want your image in
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment