Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-2458] iPad Orientation Bug on start

GitHub Issuen/a
TypeBug
PriorityTrivial
StatusClosed
ResolutionFixed
Resolution Date2011-10-27T15:17:05.000+0000
Affected Version/sn/a
Fix Version/sSprint 2011-36, Release 1.8.0
ComponentsiOS
Labelsipad, module_orientation, orientation, qe-testadded
ReporterAdriano Paladini
AssigneeStephen Tramer
Created2011-04-15T03:20:18.000+0000
Updated2013-08-30T09:11:56.000+0000

Description

Hi, everbody
I have a serious problem in iPad orientation.

This error ocurred in 1.4.3 and 1.5.0 (11/29/2010).

My app has this code:

var win = Ti.UI.createWindow({
    backgroundImage: 'img/bkg.png',
    orientationModes: [Ti.UI.PORTRAIT, Ti.UI.UPSIDE_PORTRAIT, Ti.UI.LANDSCAPE_RIGHT, Ti.UI.LANDSCAPE_LEFT]
});

and in tiapp.xml:

<orientations device="ipad">
            <orientation>Ti.UI.PORTRAIT</orientation>
            <orientation>Ti.UI.UPSIDE_PORTRAIT</orientation>
            <orientation>Ti.UI.LANDSCAPE_LEFT</orientation>
            <orientation>Ti.UI.LANDSCAPE_RIGHT</orientation>
        </orientations>

My app start normal in Portrait, and rotate normal, but if i put iPad on Landscape before, and open my app, it show a landscape splash and switch to a portrait window in landscape mode.

Creating a window that is cut down and with black border the side.

Sorry for my poor english, i'm Brazilian.

Attachments

FileDateSize
OrientationTest.zip2011-09-06T17:06:01.000+00001581804
photo 1.PNG2011-06-02T14:04:28.000+000025196
photo 2.PNG2011-06-02T14:04:28.000+000025179

Comments

  1. Adriano Paladini 2011-04-15

    Hi, i teste the final version of 1.5.0 and now this was corrected.

  2. Stephen Tramer 2011-04-15

    Going to mark this resolved, test submitted to internal tests.

  3. Pedro Enrique 2011-04-15

    Sorry to reopen, but this is still happening.

    Changed tiapp.xml to:

       <iphone>
               <orientations device="ipad">
                   <orientation>Ti.UI.LANDSCAPE_LEFT</orientation>
                   <orientation>Ti.UI.LANDSCAPE_RIGHT</orientation>
               </orientations>
       </iphone>
       

    The build/iphone/ directory was emptied before testing.

    Tested on iPad Simulator with iPad-KS
    Ti API 1.6 (Feb 4 2011 17:12 r349debe8)

    Please refer to this HD ticket for details:
    http://developer.appcelerator.com/helpdesk/view/71251#c336281">http://developer.appcelerator.com/helpdesk/view/71251#c336281

  4. Stephen Tramer 2011-04-15

    This is not a bug. Apple's documentation specifies that the first orientation listed in the Info.plist, when enforced, is the orientation that your app is forced into before starting. This is not something we can change.

    IN ORDER TO GET AROUND THIS:

    • Do not list any specified orientations for your tiapp.xml
    • Only specify orientations on a per-page basis in your .js files
  5. Ygor Lemos 2011-04-15

    Ok. But how can I do it for a SplitView app ? Will it work on 1.5.1 ?

  6. Ygor Lemos 2011-04-15

    Also this does not change the fact that splitWindow is not obeying orientation... even when you set it explicitly, iPad keeps rotating the screen:

    splitWin = Ti.UI.iPad.createSplitWindow({

       masterView:poteTMS.masterNav,
       detailView:poteTMS.detailNav,
       orientationModes:[ Titanium.UI.LANDSCAPE_LEFT,Titanium.UI.LANDSCAPE_RIGHT ]
       

    });

    Even with this piece of code on app.js and the proposed workaround, the window turns around with accelerometer...

    Tested under 1.5.1 and continuous build 1.6.0-20110204141203-osx

  7. Ygor Lemos 2011-04-15

    As for Apple official iOS4 Documentation:

    A split view controller relies on its two view controllers to determine whether interface orientation changes should be made. If one or both of the view controllers do not support the new orientation, no change is made. This is true even in portrait mode, where the first view controller is not displayed. Therefore, you must override the shouldAutorotateToInterfaceOrientation: method for both view controllers and return YES for all supported orientations.

    So the override is not being made I guess...

    Reference: (https://developer.apple.com/library/ios/#featuredarticles/ViewControllerPGforiPhoneOS/iPadControllers/iPadControllers.html#//apple_ref/doc/uid/TP40007457-CH6-SW1">https://developer.apple.com/library/ios/#featuredarticles/ViewContr...)

  8. Ygor Lemos 2011-04-15

    Nevermind, what you got to do is the following:

    On tiapp.xml you need:

       <orientations device="ipad">
           <orientation>Ti.UI.LANDSCAPE_LEFT</orientation>
           <orientation>Ti.UI.LANDSCAPE_RIGHT</orientation>
       </orientations>
       

    On your splitWindow declaration, you need:

       xxx.splitView = Ti.UI.iPad.createSplitWindow({
           masterView: xxx.masterNav,
           detailView: xxx.detailNav,
           orientationModes:[ Ti.UI.LANDSCAPE_LEFT,Ti.UI.LANDSCAPE_RIGHT ]
       });
       

    And -on both- your views / windows (master and detail), you need:

       xxx.masterWindow = Ti.UI.createWindow({
           title:'Nav Menu',
           backgroundColor:'#e8ecef',
           orientationModes:[ Ti.UI.LANDSCAPE_LEFT,Ti.UI.LANDSCAPE_RIGHT ]
       });
       

    Setting orientationModes on splitWindow, master and detail views / windows now forces the splitWindow based app to never rotate.

    This should be documented...

    Thanks.

  9. Alan Leard 2011-04-15

    Even with everything listed above set, if you start the application in Portrait mode (when only landscape is available), the first time it loads, you still get a split second rotation that shouldn't happen.

    View here: http://screencast.com/t/71qQBMM7G">http://screencast.com/t/71qQBMM7G

    Testing on device, built with 1.6RC1

    Reference Ticket: http://developer.appcelerator.com/helpdesk/view/74261">http://developer.appcelerator.com/helpdesk/view/74261

  10. Stephen Tramer 2011-04-15

    This might be an apple bug, have to move it to TBS.

  11. Ralf Pfeiffer 2011-04-26

    There is unclarity on this issue, so we will push to reevaluate this in next release's planning process.
  12. Jon Alter 2011-06-02

    Another repro case. If you set the orientation to Portrait only in tiapp.xml and then run the code below. When you start the app, hold the iPad up in landscape(it does not do it consistently if it is laying down). You will see that the navBar does not go to the top where it should. You will see the screen rotate (would rather not see this) and then the navBar will be set down from where it should be (see attached pictures).
        <orientations device="ipad">
        	<orientation>Ti.UI.PORTRAIT</orientation>
        </orientations>
        
        Titanium.UI.setBackgroundColor('#f00');
        	
        var mainWin = Titanium.UI.createWindow({
        	orientationModes:[Titanium.UI.PORTRAIT]
        });
        
        var mainMenuWin = Titanium.UI.createWindow({
        	title: "I'm the navBar - too low!!",
        	backgroundColor:"#00f"
        });
        var nav = Titanium.UI.iPhone.createNavigationGroup({
        	window: mainMenuWin
        });
        mainWin.add(nav);
        
        mainWin.open();
        mainWin.addEventListener('open', function(e){
        	setTimeout( function(){
        		// mainWin.add(nav);
        	}, 500);
        });
        

    Workaround

    Add your elements to the window a short amount of time after the window opens.
        mainWin.addEventListener('open', function(e){
        	setTimeout( function(){
        		mainWin.add(nav);
        	}, 500);
        });
        

    Tested With

    TiSDK 1.7.0.RC1 iPad 1 3.2.2

    Associated Helpdesk Ticket

    http://appc.me/c/APP-521248
  13. Thomas Huelbert 2011-06-27

    3.2 only - not seen on newer revs of OS - 1.7.2.v20110624152637
  14. Stephen Tramer 2011-06-27

    Confirmed to appear only on 3.2 devices. Pre-4.0 support is being dropped for release 1.8.0, and there is no reason to keep an iPad device at a version below 4.2.
  15. Pedro Enrique 2011-09-06

    Reopening.

    tiapp.xml

        <orientations device="ipad">
        	<orientation>Ti.UI.PORTRAIT</orientation>
        	<orientation>Ti.UI.UPSIDE_PORTRAIT</orientation>
        	<orientation>Ti.UI.LANDSCAPE_LEFT</orientation>
        	<orientation>Ti.UI.LANDSCAPE_RIGHT</orientation>
        </orientations>
        

    app.js

        var win = Ti.UI.createWindow({
          backgroundColor:'#fff',
          orientationModes:[
            Titanium.UI.LANDSCAPE_LEFT,
            Titanium.UI.LANDSCAPE_RIGHT,
            Titanium.UI.PORTRAIT,
            Titanium.UI.UPSIDE_PORTRAIT,
          ]
        });
        
        
        var label = Ti.UI.createLabel({
          text:'Hello World',
          width:'auto',
          height:'auto'
        });
        
        win.add(label);
        
        win.open();
        

    To Reproduce:

    Launch app in any orientation besides portrait.

    Expected behavior:

    The app launches in it's current orientation mode.

    What really happens:

    The app launches always in portrait. Environment:
        iPad Simulator 4.3
        iPad device 4.3.3
        Ti SDK 1.8.0.v20110906105416
        
  16. Reggie Seagraves 2011-09-14

    Resolved by https://github.com/appcelerator/titanium_mobile/pull/464.
  17. Alan Vaghti 2011-09-15

    Fix verified on iPad 4.3.5 and iPad 2 4.3.5. SDK used for testing: 1.8.0v20110915101349

JSON Source