Resize image with finger gestures

You must Login before you can answer or comment on any questions.

Hi,

I can't find any solid bit of code to resize an image view. I'm using Titanium 1.8.2.

var view = Titanium.UI.createScrollableView({
    contentWidth:'auto',
    contentHeight:'auto',
    showVerticalScrollIndicator:true,
    showHorizontalScrollIndicator:true,
    maxZoomScale : 2.0,
    touchEnabled: true,
    top: 0,
});
var image = Titanium.UI.createImageView({url:venueMapUrl}); 
view.add(image);
I'm guessing this is possible as it seems to be working for zoom with google maps, I just can't get it working with a simple image.

Thanks in advance for any help.

Paul

1 Answer

Accepted Answer

try this

var scrollView = Titanium.UI.createScrollView({
            contentWidth: Ti.Platform.displayCaps.platformWidth,
            contentHeight: Ti.Platform.displayCaps.platformHeight,
 
            height: Ti.Platform.displayCaps.platformHeight,
            width: Ti.Platform.displayCaps.platformWidth,
 
            backgroundColor:'#343434',
 
            showVerticalScrollIndicator:true,
            showHorizontalScrollIndicator:true,
 
            maxZoomScale:100,
            minZoomScale:1
        });
        win.add(scrollView);
 
        var mainImage = Ti.UI.createImageView({
            height: 470,
            width: 310,
            backgroundColor: '#343434',
            image: json.url,//<--- your image path or URL
        });
        scrollView.add(mainImage);

Your Answer

Think you can help? Login to answer this question!