Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-8193] iOS: Composite layout - horizontal layout Views don't position children correctly

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2012-04-04T14:21:43.000+0000
Affected Version/sRelease 2.0.0
Fix Version/sRelease 2.0.0, Sprint 2012-06
ComponentsiOS
Labelsmodule_view, parity, qe-testadded
ReporterNikhil Sharma
AssigneeVishal Duggal
Created2012-03-22T12:34:53.000+0000
Updated2012-04-04T14:21:43.000+0000

Description

Horizontal layout Views don't position children correctly.

Expected behavior

A red view at the top of the window (full width). An orange view occupying the left half of the red view. A blue square view immediately to the right of the orange view.

Repo Steps

1.Run the below code in app.js 2.You will see the orange view actually appears centered on the red view and the blue view actually appears at position 0,0
var win1 = Ti.UI.createWindow({  
    title:'Win 1',
    layout:'vertical',
    backgroundColor:'#fff'
});

var vw1 = Ti.UI.createView({
    layout:'horizontal',
    backgroundColor:'red',
    width:'100%',
    height:75
});
win1.add(vw1);

//
var TheOrange=Ti.UI.createView({height:75,
                                width:'160dp',
                                backgroundColor:'orange',
                                top:0
                               });

var GreenView=Ti.UI.createView({
          height:Ti.UI.SIZE,
          width:Ti.UI.SIZE,
          focusable:false,
          touchEnabled:false,
          backgroundColor:'green'
});

GreenView.add(TheOrange);
vw1.add(GreenView);

var BlueView=Ti.UI.createView({
    backgroundColor:'blue',
    width:50,
    height:50
});
vw1.add(BlueView);
//

win1.open();

Attachments

FileDateSize
expected.png2012-04-04T14:21:14.000+000012199
ios_vs_android.png2012-03-22T15:48:43.000+000063984

Comments

  1. Shawn Lipscomb 2012-03-22

    Note that the code works correctly on Android.
  2. Max Stepanov 2012-03-22

    Vishal, see the attached iOS vs Android layout behavior after the fix.
  3. Max Stepanov 2012-03-22

    Originally reported issue is fixed, but reopening due to blue box should be vertically centered within red box as on Android.
  4. Wilson Luu 2012-03-24

    Closing bug. Verified fix on: SDK build: 2.0.0.v20120323221800 Titanium Studio, build: 2.0.0.201203240504 xcode: 4.3 Device: iphone 4s Verizon (5.0.1)
  5. Shawn Lipscomb 2012-03-26

    Verified fix on SDK 2.0.0.v20120325213306. Thanks!
  6. Dustin Hyde 2012-04-04

    Attaching screenshot of expected behavior.

JSON Source