Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

zoomScale on a ScrollView

I'm trying to zoom into a scroll view, in fact I've a label inside a scrollview that I want to make bigger for the user.
I use this code on a button

zoom.addEventListener("click", function() {

    myScroll.zoomScale=4;
});
/* where zoom is mybutton and myScroll the scrollView */

And there's no way I can have it work. What does zoomScale really mean?

— asked March 31st 2010 by michel perrin
  • scrollview
  • zoomscale
0 Comments

3 Answers

  • Accepted Answer

    The soomScale property can only be used while you are pinching on a view.

    e.g.

    var scrollView = Titanium.UI.createScrollView({
        contentWidth:'auto',
        contentHeight:'auto',
        top:0,
        showVerticalScrollIndicator:true,
        showHorizontalScrollIndicator:true
       minZoomScale:0,  // your view can not zoom out smaller then 100%
       maxZoomScale:10, // your view can zoom in with a factor 10 (1000% ?)
       zoomScale:5 // default zoomed in stage when view is added on window (500%)
    });
    

    If you want the lavel to be bigger, just modify the fontsize instead, otherwise youw whole view will zoom also.

    — answered March 31st 2010 by Glenn Tillemans
    permalink
    1 Comment
    • For me zoomScale does not work before I open the window with the view. So I have to explicitly set the zoomScale again after opening with window.

      — commented February 28th 2012 by Bulat Yaminov
  • Thanks for your help, in fact I figured out that the zoom doesn't work if the max and min zoom properties are not defined.
    I also tried setting the font size but when I set a bigger font size on a text that's too short to scroll, the scrollable state is not fired automatically and I'm not able to scroll the biggertext I get.

    — answered March 31st 2010 by michel perrin
    permalink
    0 Comments
  • I was struggling to get this working, it would appear I needed to explicitly set the zoomScale property in the scrollView declaration. Then in other parts of the code if I set the zoomScale it changes. Before doing that it was ignoring it.. Weird.. (1.8.0.1)

    — answered January 4th 2012 by Mark Henderson
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.