Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-8773] iOS: contentWidth is broken

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2012-07-10T02:33:16.000+0000
Affected Version/sRelease 2.0.1
Fix Version/sRelease 2.1.0, Sprint 2012-09 Core
ComponentsiOS
LabelsSupportTeam, core, module_scrollview, qe-testadded, regression
ReporterMauro Parra-Miranda
AssigneeStephen Tramer
Created2012-04-17T16:19:37.000+0000
Updated2012-10-17T21:38:56.000+0000

Description

Problem Description

contentWidth seems to be broken. In 1.82 the 'views' added to scrollView would fall underneath each other create tiles going down the window. In 2.0.1 they extend past the desired 'contentWidth' of 320.

Actual Results

The views doesn't follow the contentWidth size.

Expected Results

The view should respect the contentWidth

Test Case

1. Create new mobile app 2. Paste this code:
var scrollView =  Ti.UI.createScrollView({
    contentWidth: 320,
    contentHeight: 'auto',
    layout: 'horizontal'
});
 
var things = [
    'item1',
    'item2',
    'item3',
    'item4',
    'item5',
    'item6' ];
 
for (var i = 0;  i < things.length;  i++) {
 
    var view = Ti.UI.createView({
        height: 90,
        width: 140,
        top: 10,
        left: 10,
        backgroundColor: '#CCC'
    });
 
    scrollView.add(view);
 
};

var win = Ti.UI.createWindow();
win.add(scrollView);
win.open();
3. Compile this with Mobile SDK 2.0.1

Extra info

If you test this with 1.8.2, works like a charm.

Q/A Discussion

http://developer.appcelerator.com/question/135543/scrollview--contentwidth--sdk-201

Comments

  1. Stephen Tramer 2012-04-20

    Adjusting sprint to reflect PR submission date
  2. Stephen Tramer 2012-04-24

    Updated test which also exercises autosizing functionality of the scrollview bounds when conjoined with horizontal and absolute contentWidth:
       var scrollView =  Ti.UI.createScrollView({
           contentWidth: 320,
           contentHeight: 'auto',
       	width:Ti.UI.SIZE,
       	height:Ti.UI.SIZE,
       	backgroundColor:'blue',
           layout: 'horizontal'
       });
         
       var things = [
           'item1',
           'item2',
           'item3',
           'item4',
           'item5',
           'item6' ];
         
       for (var i = 0;  i < things.length;  i++) {
         
           var view = Ti.UI.createView({
               height: 90,
               width: 140,
               top: 10,
               left: 10,
               backgroundColor: '#CCC'
           });
         
           scrollView.add(view);
         
       };
        
       var win = Ti.UI.createWindow();
       win.add(scrollView);
       win.open();
       
  3. Vishal Duggal 2012-04-26

    PR 2073
  4. Michael Pettiford 2012-06-14

    Closing issue Tested with Ti Studio build 2.1.0.201206131907 Ti Mobile SDK 2.1.0.v20120613210250 hash rc8ddb29e OSX Lion 10.7.3 iPhone 4S OS 5.1 Verified that the views are laid out as expected
  5. Shyam Bhadauria 2012-07-10

    Re-opening to edit label

JSON Source