I've created an image view with Ti.UI.createImageView() and i'm loading an image in it. I want the image view to scale to the size of the image. But how do i do this? I've tried the following, but that doesn't work:
var logo = Ti.UI.createImageView({ backgroundImage: '/images/logo.png', width: 'auto', height: 'auto' }); win.add(logo);This way nothing is shown. But when i set the width and height hardcoded, then it does display my image.
Is there any way to set the width and height to something like 'auto', so that the imageView automatically has the width and height of the image?
1 Answer
Accepted Answer
Change to:
var logo = Ti.UI.createImageView({ image: '/images/logo.png', width: Ti.UI.SIZE, height: Ti.UI.SIZE }); win.add(logo);
Your Answer
Think you can help? Login to answer this question!