Titanium Mobile
  1. Titanium Mobile
  2. TIMOB-9400

iOS: Children are not removed from parents view hierarchy when context is shutdown

    Details

      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);
      

        Issue Links

          Activity

          Hide
          Hidayet Dogan added a comment -

          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.

          Show
          Hidayet Dogan added a comment - 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.
          Show
          Vishal Duggal added a comment - Pull pending https://github.com/appcelerator/titanium_mobile/pull/3176
          Hide
          Blain Hamon (Inactive) added a comment -

          Pull merged

          Show
          Blain Hamon (Inactive) added a comment - Pull merged
          Show
          Vishal Duggal added a comment - Backport PR https://github.com/appcelerator/titanium_mobile/pull/3460
          Hide
          Natalie Huynh added a comment -

          Tested with 3.0.0.v201211300200208 with iPhone 5 6.0

          Show
          Natalie Huynh added a comment - Tested with 3.0.0.v201211300200208 with iPhone 5 6.0
          Hide
          Priya Agarwal added a comment -

          Reopening just to update label.

          Show
          Priya Agarwal added a comment - Reopening just to update label.
          Hide
          Eric Merriman added a comment -

          Was reopened in error. Closing.

          Show
          Eric Merriman added a comment - Was reopened in error. Closing.

            People

            • Assignee:
              Vishal Duggal
              Reporter:
              Vishal Duggal
            • Watchers:
              8 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development