Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-9400] iOS: Children are not removed from parents view hierarchy when context is shutdown

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2013-11-12T23:17:35.000+0000
Affected Version/sRelease 2.1.0
Fix Version/sRelease 3.0.0, Release 3.1.0, 2012 Sprint 21 API, 2012 Sprint 21
ComponentsiOS
Labelsapi, qe-port
ReporterVishal Duggal
AssigneeVishal Duggal
Created2012-06-05T14:19:49.000+0000
Updated2013-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);

Comments

  1. Hidayet Dogan 2012-06-09

    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.
  2. Vishal Duggal 2012-10-11

    Pull pending https://github.com/appcelerator/titanium_mobile/pull/3176
  3. Blain Hamon 2012-10-16

    Pull merged
  4. Vishal Duggal 2012-11-21

    Backport PR https://github.com/appcelerator/titanium_mobile/pull/3460
  5. Natalie Huynh 2012-12-04

    Tested with 3.0.0.v201211300200208 with iPhone 5 6.0
  6. Priya Agarwal 2013-07-17

    Reopening just to update label.
  7. Eric Merriman 2013-11-12

    Was reopened in error. Closing.

JSON Source