Titanium Community Questions & Answer Archive

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

How can I update the window when the orientation changes?

I added a Ti.Gesture.addEventListener('orientationchange') to my class. I'm trying to shift everything left a certain amount when the view updates. How can I do this? label.left = 100;?

— asked June 3rd 2010 by Joshua Kehn
  • events
  • ipad
  • iphone
  • ipod-touch
  • left
  • orientation
  • orientationchange
0 Comments

2 Answers

  • I'd also be interested is a little code sample to make that work

    — answered June 3rd 2010 by Stephen Gilboy
    permalink
    0 Comments
  • Never mind, did it.

    Code:

    Ti.Gesture.addEventListener('orientationchange',function(e)
    {
    
         // now do stuff... refresh etc..
    
        if(e.orientation == 1 || e.orientation == 2)
        {
            // Function that changes the left property of 
            // just about every item in the view
            Window.rotateStandard();
        }
        else if(e.orientation == 3 || e.orientation == 4)
        {
            Window.rotateLandscape();
        }
        else
        {
            // Guess
            Window.rotateStandard();
        }
    });
    
    — answered June 3rd 2010 by Joshua Kehn
    permalink
    1 Comment
    • Could you share the snippet in case somebody else has this question? Thanks…

      — commented June 3rd 2010 by Kevin Whinnery
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.