Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-4782] iPad Orientation Regression

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2011-09-14T16:07:35.000+0000
Affected Version/sn/a
Fix Version/sSprint 2011-36, Release 1.8.0
ComponentsiOS
Labelsmodule_orientation, qe-testadded
ReporterAlan Leard
AssigneeBlain Hamon
Created2011-07-26T09:27:56.000+0000
Updated2014-06-19T12:46:21.000+0000

Description

If you set landscape only on an iPad app, 1.7.2 and up do not recognize it, and it launches in Portrait. Test Code:
Titanium.UI.setBackgroundColor('#000');

var win = Titanium.UI.createWindow({
    title:'Tab 1',
    backgroundColor:'#fff'
});

var label1 = Titanium.UI.createLabel({
	color:'#999',
	text:'I am Window 1',
	font:{fontSize:20,fontFamily:'Helvetica Neue'},
	textAlign:'center',
	width:'auto'
});
win.add(label1);
win.open()
<iphone>
		<orientations device="iphone">
			<orientation>Ti.UI.LANDSCAPE_LEFT</orientation>
		</orientations>
		<orientations device="ipad">
			<orientation>Ti.UI.LANDSCAPE_LEFT</orientation>
			<orientation>Ti.UI.LANDSCAPE_RIGHT</orientation>
		</orientations>
</iphone>

Comments

  1. Blain Hamon 2011-08-01

    The sample code is invalid; the window MUST provide its orientation preferences. The XML only specifies on launch. The reason that 1.7.1 and before had a different behavior was a bug where it was not updating its orientation requests properly. Below is a proper code snippet that, when put into the example app, does the correct behavior.
       var win = Titanium.UI.createWindow({
           title:'Tab 1',
           backgroundColor:'#fff',
           orientationModes:[
       		Titanium.UI.LANDSCAPE_LEFT,
       		Titanium.UI.LANDSCAPE_RIGHT,
       	]
       });
       
  2. Alan Leard 2011-08-02

    After adding the above code snippet, there is still a visual rotation on app launch that is not the desired result. Application should launch and statically display a landscape view, not the window rotating upon opening.
  3. Eduardo Gomez 2011-08-03

    Associated HD ticket

    Customer reported an issue alike this, http://appc.me/c/APP-537473

    Problem

    if landscape_left and landscape_right are configured, the app always starts in landscape_right.

    Tested on

    Simulator iOS 4.x / Device iPad 1

    Repro sequence

       var window = Ti.UI.createWindow({
         left:0,
         top:0,
         width:1024,
         height:768,
         backgroundColor:"black"
       });
       window.orientationModes = [Titanium.UI.LANDSCAPE_LEFT, Titanium.UI.LANDSCAPE_RIGHT];
       
       var root_view = Ti.UI.createView({
         left:0,
         top:0,
         width:1024,
         height:768
       });
       
       
       var visible = true;
       
       var view1 = Ti.UI.createImageView({
         top:0,
         height:300,
         width:1024,
         left:0,
         image:"http://agro.biodiver.se/wp-content/uploads/2010/09/catie-pano2-1024x300.jpg"
       });
       
       var view2 = Ti.UI.createImageView({
         bottom:0,
         left:0,
         width:1024,
         height:300,
         image:"http://kiarasbastelwelt.ki.funpic.de/masken/1024x300DMaskms.jpg"
       });
       
       var button = Ti.UI.createButton({
         title:"show/hide",
         width:300,
         height:50,
         top:320,
         left:300
       });
       button.addEventListener("click", function(e) {
         if(visible) {
           visible = false;
           view1.hide();
           view2.hide();
         } else {
           visible = true;
           view1.show();
           view2.show();
         }
       })
       
       root_view.add(view1);
       root_view.add(view2);
       root_view.add(button);
       
       window.add(root_view);
       window.open();
       

    Additional info

    Tried to manually set Orientation on Info.plist (copy&paste from Buld/iphone/Info.plist to Root project folder): {noformat} UISupportedInterfaceOrientations UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight {noformat} Let me know if another Jira ticket should be opened instead of adding info to this one.
  4. Vikramjeet Singh 2011-08-29

    Tested On: Mac OSX Lion TiMob: 1.8.0v20110819142548 TiStud: 1.0.4.201108101535 Devices: iPhpne Simulator iPad2 version 4.3.5 iPhen4 version 4.2.10 iPod 3
  5. Alan Vaghti 2011-09-07

    Reopening issue. It is my understanding that if a window does not specify orientation, then it will get it's orientation from what is in the tiapp.xml. If so, then the original test code is valid and the issue is still occurring (tested in SDK 1.8.0v20110906155354).
  6. Don Thorp 2011-09-09

    Removed Sprint 2011-31 since it was re-opened.
  7. Reggie Seagraves 2011-09-14

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

    Fix verified on an iPad 2 4.3.5, iPad 4.3.5, iPhone 4 4.2.10, iPod 3rd gen 4.0.2. SDK used: 1.8.0v20110915133349 By design, the test case does need Blain's changes to be a proper test case.

JSON Source