Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-20146] iOS: Autolayout lays out wrongly when view is added to window

GitHub Issuen/a
TypeBug
PriorityHigh
StatusReopened
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
ComponentsiOS
LabelsAL-5.4.0
ReporterChee Kiat Ng
AssigneeUnknown
Created2015-12-15T03:48:37.000+0000
Updated2018-02-28T19:55:59.000+0000

Description

Steps to reproduce

1. Create a new titanium classic app 2. add true to tiapp.xml 3. Change app.js to this:
var mainWindow =Ti.UI.createWindow({
top:20,
backgroundColor:'white',
layout:'horizontal'
});
 
var mainView = Ti.UI.createView({
backgroundColor:'white',
layout:'horizontal',
});
 
 
var label1 = Ti.UI.createLabel({
text : 'label1 ',
});
 
var label2 = Ti.UI.createLabel({
text : 'label2 ',
});
var label3 = Ti.UI.createLabel({
text : 'label3 ',
});
var label4 = Ti.UI.createLabel({
text : 'label4 ',
});

var label5 = Ti.UI.createLabel({
text : 'label5 and more ',
height: 40
});
 
var label6 = Ti.UI.createLabel({
text : 'label6 ',
horizontalWrap: true
});
var label7 = Ti.UI.createLabel({
text : 'label7 ',
});
var label8 = Ti.UI.createLabel({
text : 'label8 ',
});
 
// Add to the parent view.
mainView.add(label1);
mainView.add(label2);
mainView.add(label3);
mainView.add(label4);
mainView.add(label5);
mainView.add(label6);
mainView.add(label7);
mainView.add(label8);
 
mainWindow.add(mainView);
mainWindow.open();

Expected result

you should see the labels 20pixels away from to top edge.

Actual result

you will see the labels right at the top edge.

Comments

  1. Harry Bryant 2016-07-19

    Adding true to the tiapp.xml prevents the app from opening the window upon launch. This does not occur when autolayout is set to false. *Reopening Ticket.* Tested On: iPhone 6S (9.3.2) Device Mac OSX El Capitan 10.11.5 Ti SDK: 5.4.0.v20160713141635 Appc Studio: 4.7.0.201607111053 Appc NPM: 4.2.7 App CLI: 5.4.0-33 Xcode 7.3 Node v4.4.7

JSON Source