Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-10741] iOS: ScrollView - last view not positioned correctly when set of views placed on scrollview with horizontal layout

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionInvalid
Resolution Date2013-04-08T05:50:01.000+0000
Affected Version/sRelease 3.0.0, Release 3.1.0
Fix Version/s2013 Sprint 07 API, 2013 Sprint 07
ComponentsiOS
Labelscore, triage
ReporterNeha Chhabra
AssigneeVishal Duggal
Created2012-09-04T03:00:37.000+0000
Updated2014-07-17T10:10:14.000+0000

Description

Last view not positioned correctly when set of views placed on scrollview with horizontal layout. This is not a regression.It even occurs on 2.1.1.GA Steps to Reproduce: 1. Run and install the app on to device. 2. Rotate the device in other orientation.(On iOS simulator the issue is seen even without rotation) Expected Result: There will be a grid in which a View of 5 colours (red,blue,pink,white and black) will appear. Actual Result: Last view not positioned correctly. aap.js
var win = Ti.UI.createWindow();
win.open();
 
    
var scrollView = Ti.UI.createScrollView({
    contentHeight:'auto',
    contentWidth:0,
    layout:'horizontal',
    backgroundColor: 'green'
});
win.add(scrollView);
   
var colors = ['red', 'blue', 'pink', 'white', 'black'];
    
var max = 120;
for(var i = 0; i < max; i++){
    var view = Ti.UI.createView({
        backgroundColor: colors[i%colors.length],
        borderColor:'gray',
        borderWidth:4,
        height: 100,
        left: 10,
        width: 100,
        top: 10
    });
     
    view.addEventListener('click', function(_event){
        scrollView.remove(_event.source);
    });
    scrollView.add(view);
}
win.add(view);

Attachments

FileDateSize
iOS Simulator Screen shot Mar 27, 2013 9.53.36 AM.png2013-03-27T08:35:44.000+00006791

Comments

  1. jithinpv 2013-03-27

    Issue reproduces Tested with Titanium Studio, build: 3.0.1.201212181159 Titanium SDK version: 3.1.0 Titanium SDK version: 3.0.2 iOS iPhone Simulator: iOS SDK version: 6.0
  2. Eric Merriman 2013-04-02

    Also verified occurs with: Mac OS 10.8.3 SDK: 3.1.0.v20130402092426 Appcelerator Studio, build: 3.1.0.201303312320 CLI 3.1.0-beta node-appc 1.0.29-beta
  3. Vishal Duggal 2013-04-08

    This bug has been filed before and has been resolved before with the same resolution. Somewhere in the test plan you have this code which is incorrect. Remove the last win.add(view) call. You are adding the same view to the scrollView and window and the last call wins.

JSON Source