Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-18789

iOS: Can not Get Correct Orientation Information when orientation is not portrait

    Details

    • Type: Bug
    • Status: Closed
    • Priority: High
    • Resolution: Invalid
    • Affects Version/s: Release 3.5.1
    • Fix Version/s: None
    • Component/s: iOS
    • Environment:

      SDK 3.5.*
      iOS 8.2

    • Story Points:
      5
    • Sprint:
      2015 Sprint 09 SDK

      Description

      Description:

      Using window.getOrientation() can't get correct info if orientationModes is not portrait.

      Reproduce Step:

      Simply run the test case in classic project. (force Orientation to Landscape_Right)

      app.js

      var self = Ti.UI.createWindow({ 
      backgroundColor:'#ffffff', 
      orientationModes : [Ti.UI.LANDSCAPE_RIGHT]	
      }); 
      Ti.API.debug('Reference'); 
      Ti.API.debug('Ti.UI.LANDSCAPE_RIGHT:' + Ti.UI.LANDSCAPE_RIGHT); 
      Ti.API.debug('Ti.UI.LANDSCAPE_LEFT:' + Ti.UI.LANDSCAPE_LEFT); 
      Ti.API.debug('Ti.UI.PORTRAIT:' + Ti.UI.PORTRAIT); 
      Ti.API.debug('Ti.UI.UPSIDE_PORTRAIT:' + Ti.UI.UPSIDE_PORTRAIT); 
       
      var label = Ti.UI.createLabel({
      	text: "Test Window for Orientation!",
      	Top: '30%',
      });
      self.add(label);
       
      //construct UI 
      self.addEventListener('open', function(e) { 
      Ti.API.debug('When Opened, Window Orientation:' + self.getOrientation() + ", Gesture Orientaiton:" + Ti.Gesture.getOrientation()); 
      }); 
      self.addEventListener('focus', function(e) { 
      Ti.API.debug('When Focussed, Window Orientation:' + self.getOrientation() + ", Gesture Orientaiton:" + Ti.Gesture.getOrientation()); 
      }); 
      Ti.Gesture.addEventListener('orientationchange', function(e) { 
      Ti.API.debug('Window Orientation:' + self.getOrientation() + ", Gesture Orientaiton:" + Ti.Gesture.getOrientation()); 
      }); 
      self.open();
      

      Expect Result:

      Should get the correct information about orientation.

      Actual Result:

      Window opens in landscape mode as expected, but none of the event listeners configured as in the above code log the correct orientation

      iOS log

      [DEBUG] : Reference 
      [DEBUG] : Ti.UI.LANDSCAPE_RIGHT:3 
      [DEBUG] : Ti.UI.LANDSCAPE_LEFT:4 
      [DEBUG] : Ti.UI.PORTRAIT:1 
      [DEBUG] : Ti.UI.UPSIDE_PORTRAIT:2 
      [DEBUG] : Loading: /Users/achyutjoshi/Library/Developer/CoreSimulator/Devices/DEE57654-B959-4BB6-942A-370CD35E6CDC/data/Containers/Bundle/Application/EEFFC1D4-C8D4-48F0-9783-C26BAC2992EE/orientation.app/_app_props_.json, Resource: _app_props__json 
      [DEBUG] : Forcing rotation to 3. Current Orientation 1. This is not good UI design. Please reconsider. 
      [DEBUG] : Application booted in 130.232036 ms 
      [DEBUG] : When Opened, Window Orientation:1, Gesture Orientaiton:1 
      [DEBUG] : When Focussed, Window Orientation:1, Gesture Orientaiton:1 
      

      Note:

      If run the test code on Android device, the result will show the orientation change. like this:

      Android Log

      [DEBUG] : Reference 
      [DEBUG] : Ti.UI.LANDSCAPE_RIGHT:4 
      [DEBUG] : Ti.UI.LANDSCAPE_LEFT:2 
      [DEBUG] : Ti.UI.PORTRAIT:1 
      [DEBUG] : Ti.UI.UPSIDE_PORTRAIT:3 
      [INFO] : TiRootActivity: (main) [0,0] checkpoint, on root activity resume. activity = com.orientation.OrientationActivity@421c5c30 
      [INFO] : I/Adreno-EGL: <qeglDrvAPI_eglInitialize:410>: EGL 1.4 QUALCOMM build: AU_LINUX_ANDROID_LNX.LA.3.5.1_RB1.04.04.02.048.018_msm8226_LNX.LA.3.5.1_RB1__release_AU () 
      [INFO] : I/Adreno-EGL: OpenGL ES Shader Compiler Version: E031.24.00.08 
      [INFO] : I/Adreno-EGL: Build Date: 03/07/14 Fri 
      [INFO] : I/Adreno-EGL: Local Branch: 
      [INFO] : I/Adreno-EGL: Remote Branch: quic/LNX.LA.3.5.1_RB1.1 
      [INFO] : I/Adreno-EGL: Local Patches: NONE 
      [INFO] : I/Adreno-EGL: Reconstruct Branch: AU_LINUX_ANDROID_LNX.LA.3.5.1_RB1.04.04.02.048.018 + f2fd134 + NOTHING 
      [DEBUG] : OpenGLRenderer: Enabling debug mode 0 
      [DEBUG] : Window: Checkpoint: postWindowCreated() 
      [DEBUG] : When Opened, Window Orientation:1, Gesture Orientaiton:1 
      [DEBUG] : When Focussed, Window Orientation:1, Gesture Orientaiton:1 
      [DEBUG] : Window Orientation:2, Gesture Orientaiton:2 
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                ingo Ingo Muschenetz
                Reporter:
                sliang Shuo Liang
              • Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Titanium SDK/CLI <> Titanium Mobile
                    Synced with:
                    TIMOB-19852
                    Sync status:
                    ERROR
                    Last received:
                    Last sent:

                    Git Source Code