Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-24738] iOS: Close all Ti.UI.Tab windows at once

GitHub Issuen/a
TypeNew Feature
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2017-06-27T15:43:31.000+0000
Affected Version/sn/a
Fix Version/sRelease 6.2.0
ComponentsiOS
Labelsios, qe-6.2.0, tabgroup
ReporterHans Knöchel
AssigneeHans Knöchel
Created2017-05-26T19:33:03.000+0000
Updated2017-06-29T11:59:44.000+0000

Description

On iOS, the user can close all current windows that are opened in a tab window at once (instead of closing all manually). It is commonly used, so we should expose it as well. Proposed API: Ti.UI.Tab.popToRootWindow (similar to TIMOB-23567).

Comments

  1. Hans Knöchel 2017-05-26

    PR: https://github.com/appcelerator/titanium_mobile/pull/9094 Test-Case:
       
       /**
       *  TIMOB-24738
       *
       *  Opens MAX_WINDOWS windows inside the navigation window stack and closes all after
       *  reaching the 3rd window.
       **/
       
       var i = 0;
       var MAX_WINDOWS = 3;
       var tabBar = Ti.UI.createTabGroup();
       var tab = Ti.UI.createTab({window: createWindow(++i), title: 'My Tab'});
       
       tabBar.addTab(tab);
       tabBar.open();
       
       function createWindow(num) {
          var win = Ti.UI.createWindow({title: "Window " + num, backgroundColor: "#fff"});
          var btn = Ti.UI.createButton({title: (i == MAX_WINDOWS) ? "Close all windows" : ("Open Window " + (num + 1))});
          
          win.addEventListener("close", function() {
              Ti.API.warn("Closing " + this.title);
          });
          
          btn.addEventListener("click", function() {
              
              if (i == MAX_WINDOWS) {
                  tab.popToRootWindow({animated: true});
                  i = 0;
                  return;
              }
              tab.open(createWindow(++i));
          });
          
          win.add(btn);
          return win;
       }
       
  2. Harry Bryant 2017-06-29

    Verified, Ti.UI.Tab.popToRootWindow now allows for closing all windows at once. Tested On: iPhone 7 10.3.2 Device & Simulator Mac OS Sierra (10.12.5) Ti SDK: 6.2.0.v20170628154113 Appc NPM: 4.2.9 App CLI: 6.2.2 Xcode 8.3.3 Node v4.6.0 *Closing ticket.*

JSON Source