Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-3497] ScrollView and OrientationChange iPhone issue

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2011-06-06T15:44:05.000+0000
Affected Version/sn/a
Fix Version/sSprint 2011-23
ComponentsiOS
Labelsn/a
ReporterDaniel Tome
AssigneeReggie Seagraves
Created2011-04-15T03:45:55.000+0000
Updated2011-06-06T15:53:34.000+0000

Description

When changing orientation mode from portrait to landscape and vice versa, the current view changes. (though the currentPage will be correct, the visible view on screen is incorrect)
This has been tested on 1.6.1 and 1.6.x CI build. And iPhone 4.2

Steps to reproduce this error:
Scroll to view 22 while in portrait mode.
Rotate to landscape mode.
Rotate back to portrait mode. (you'll notice the view changes to 29)
Rotate to landscape mode. (the view changes to view 19)
The currentPage is still 22.

Code:

var win = Titanium.UI.createWindow({  
    backgroundColor:'#fff',
    orientationModes : [Titanium.UI.LANDSCAPE_LEFT, Titanium.UI.LANDSCAPE_RIGHT, 
    Titanium.UI.PORTRAIT, Titanium.UI.UPSIDE_PORTRAIT]
});
var views_arr = [];
for(var i=0; i<30; i++) {
    views_arr[i] = Ti.UI.createView({
        top:0,
        left:0,
        width:320,
        height:480,
        borderColor:'#00F',
        borderWidth:1 
    });
    var lbl = Titanium.UI.createLabel({
        text:'view '+i,
        color:'#000',
        top: 50,
        left:50
    });
    views_arr[i].add(lbl);
}

scrollableView = Titanium.UI.createScrollableView({
    views: views_arr,
    top: 0,
    left: 0,
    width:'100%',
    height:'100%'
});
Titanium.Gesture.addEventListener('orientationchange', function(e){
    Ti.API.info('CurrentPage: ' + scrollableView.currentPage);      
});
win.add(scrollableView);
win.open();

Comments

  1. Pedro Enrique 2011-05-06

    This is still not working in the latest 1.6.3 from Apr 18 2011 16:23 (rb8672b44). Tested in iPhone Simulator 4.3 And there is a helpdesk customer that has encounter this: Ticket number APP-856157 (it is private and not visible to the public)
  2. Pedro Enrique 2011-06-06

    We have another customer in the Helpdesk asking for this fix - using 1.7.0 RC1 and 1.8 http://support.appcelerator.com/tickets/APP-573311/homepage
  3. Reggie Seagraves 2011-06-06

    I fixed this in a previous checkin.
  4. Eric Merriman 2011-06-06

    Verified View remains at 22 regardless of orientation change. Tested with simulator 4.3 and Verizon iPhone 4 (4.2.8) , Titanium Studio, build: 1.0.0.201106021621, Titanium SDK version: 1.8.0 r477c7b27. Closing.

JSON Source