[TIMOB-9400] iOS: Children are not removed from parents view hierarchy when context is shutdown
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2013-11-12T23:17:35.000+0000 |
Affected Version/s | Release 2.1.0 |
Fix Version/s | Release 3.0.0, Release 3.1.0, 2012 Sprint 21 API, 2012 Sprint 21 |
Components | iOS |
Labels | api, qe-port |
Reporter | Vishal Duggal |
Assignee | Vishal Duggal |
Created | 2012-06-05T14:19:49.000+0000 |
Updated | 2013-11-12T23:17:40.000+0000 |
Description
Steps to reproduce
Run the code.
1. Open TableWindow
2. Open Detail Window
3. Back to Table Window
4. Back to Main Window
Repeat steps 1 through 4 till you see the table view blanked out
Test code below.
FILE: app.js
Ti.UI.setBackgroundColor('#fff');
var tabGroup = Ti.UI.createTabGroup();
var winMain = Ti.UI.createWindow({
url: 'main.js',
title: 'Main Window'
});
var tab1 = Ti.UI.createTab({
window: winMain,
title: 'Main Window'
})
tabGroup.addTab(tab1);
tabGroup.open();
FILE: main.js
var winTable = Ti.UI.createWindow({
url: 'table.js',
title: 'Table Window'
});
var button = Ti.UI.createButton({
title: 'Open Window with Table'
});
button.addEventListener('click', function(e) {
Ti.UI.currentTab.open(winTable, {animated: true});
});
Ti.UI.currentWindow.add(button);
FILE: table.js
var winDetail = Ti.UI.createWindow({
url: 'detail.js',
title: 'Detail Window'
});
var table = Ti.UI.createTableView();
table.addEventListener('click', function(e) {
winDetail.sectionIndex = e.rowData.sectionIndex;
winDetail.rowIndex = e.rowData.rowIndex;
Ti.UI.currentTab.open(winDetail, {animated: true});
});
Ti.UI.currentWindow.add(table);
var data = [];
for (var i = 0; i < 5; i++) {
data[i] = Ti.UI.createTableViewSection({
headerTitle: 'Section ' + i
});
for (var j = 0; j < 5; j++) {
var row = Ti.UI.createTableViewRow({
className: 'row',
hasDetail: true,
sectionIndex: i,
rowIndex: j
});
var container = Ti.UI.createView({
layout: 'vertical',
height: Ti.UI.SIZE,
top: 10,
left: 10,
bottom: 10,
right: 10
});
container.add(Ti.UI.createLabel({
left: 0,
text: 'Label ' + j,
font: {
fontWeight: 'bold',
fontSize: 16
}
}));
container.add(Ti.UI.createLabel({
top: 5,
left: 0,
text: 'Sub Label ' + j,
font: {
fontStyle: 'italic',
fontSize: 14
}
}));
row.add(container);
data[i].add(row);
}
table.setData(data);
}
FILE: detail.js
var label = Ti.UI.createLabel({
text: 'Section: ' + Ti.UI.currentWindow.sectionIndex + ' Row: ' + Ti.UI.currentWindow.rowIndex
});
Ti.UI.currentWindow.add(label);
Affect version is not only 2.1.0 but 2.0.1GA2 and 2.0.2GA are also affected. I think the problem comes with Titanium Mobile SDK version 2 layout changes (I haven't checked SDK code changes). I did not notice this problem when using 1.8.x.
Pull pending https://github.com/appcelerator/titanium_mobile/pull/3176
Pull merged
Backport PR https://github.com/appcelerator/titanium_mobile/pull/3460
Tested with 3.0.0.v201211300200208 with iPhone 5 6.0
Reopening just to update label.
Was reopened in error. Closing.