Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-9832] iOS: Warning shown when removing the last tab from a tabgroup

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionCannot Reproduce
Resolution Date2017-06-19T21:29:05.000+0000
Affected Version/sRelease 2.1.0
Fix Version/sn/a
ComponentsiOS
Labelsapi, parity
ReporterSabil Rahim
AssigneeEric Merriman
Created2012-06-28T12:13:57.000+0000
Updated2017-06-19T21:29:05.000+0000

Description

The following warning is shown when the last tab from the tabgroup is removed.

-[UITabBarController setSelectedViewController:] only a view controller in the tab bar controller's list of view controllers can be selected.

Steps to reproduce

1. copy the following code to app.js 2. Click on remove tab2 and remove tab1 labels. 3. warning appear on the consolve

Current Behavior

Warning is shown when removing the final tab.

Expected Behavior

No Warning should be shown when removing the final tab.
// create tab group
var tabGroup = Titanium.UI.createTabGroup();
  
var win1 = Titanium.UI.createWindow({  
    title:'Tab 1',
    backgroundColor:'#fff'
});
var tab1 = Titanium.UI.createTab({  
    icon:'KS_nav_views.png',
    title:'Tab 1',
    window:win1
});
  
var label1 = Titanium.UI.createLabel({
    color:'#999',
    text:'Remove Tab1',
    font:{fontSize:20,fontFamily:'Helvetica Neue'},
    textAlign:'center',
    width:'auto'
});
  
label1.addEventListener('click', function() {
    tabGroup.removeTab(tab1);
    label1 = win1 = tab1 = null;
});
  
win1.add(label1);
 
var win2 = Titanium.UI.createWindow({  
    title:'Tab 2',
    backgroundColor:'#fff'
});
var tab2 = Titanium.UI.createTab({  
    icon:'KS_nav_ui.png',
    title:'Tab 2',
    window:win2
});
  
var label2 = Titanium.UI.createLabel({
    color:'#999',
    text:'remove tab2',
    font:{fontSize:20,fontFamily:'Helvetica Neue'},
    textAlign:'center',
    width:'auto'
});
  
label2.addEventListener('click', function() {
    tabGroup.removeTab(tab2);
    label2 = win2 = tab2 = null;
});
 
win2.add(label2);
  
//  add tabs
  
tabGroup.addTab(tab1);  
tabGroup.addTab(tab2);  
  
// open tab group
tabGroup.open();

Comments

  1. Carl Orthlieb 2012-06-28

    Sabil, what is the wording of the warning so that people can recognize it?
  2. jithinpv 2013-04-11

    incomplete test case
  3. Lee Morris 2017-06-19

    I am unable to reproduce this issue with the following environment; iPhone 7 (10.2) Studio 4.9.0.201705302345 Ti SDK 6.1.1.v20170609091155 Appc NPM 4.2.9 Appc CLI 6.2.1 Ti CLI 5.0.13 Alloy 1.9.11 Arrow 2.0.0 Xcode 8.2 (8C38) Node v4.8.2 Java 1.8.0_131

JSON Source