[TIMOB-10741] iOS: ScrollView - last view not positioned correctly when set of views placed on scrollview with horizontal layout
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2013-04-08T05:50:01.000+0000 |
Affected Version/s | Release 3.0.0, Release 3.1.0 |
Fix Version/s | 2013 Sprint 07 API, 2013 Sprint 07 |
Components | iOS |
Labels | core, triage |
Reporter | Neha Chhabra |
Assignee | Vishal Duggal |
Created | 2012-09-04T03:00:37.000+0000 |
Updated | 2014-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
File | Date | Size |
---|---|---|
iOS Simulator Screen shot Mar 27, 2013 9.53.36 AM.png | 2013-03-27T08:35:44.000+0000 | 6791 |
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
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
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.