Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-23567] iOS: Close all navigation windows at once

GitHub Issuen/a
TypeNew Feature
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2016-06-28T05:09:28.000+0000
Affected Version/sn/a
Fix Version/sRelease 6.0.0
ComponentsiOS
Labelsios, navigationWindow, qe-6.0.0
ReporterHans Knöchel
AssigneeHans Knöchel
Created2016-06-28T02:22:02.000+0000
Updated2017-05-26T19:33:04.000+0000

Description

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

Comments

  1. Hans Knöchel 2016-06-28

    PR: https://github.com/appcelerator/titanium_mobile/pull/8091 Demo:
       
       /**
        *  TIMOB-23567
        *
        *  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 nav = Ti.UI.iOS.createNavigationWindow({window: createWindow(++i)});
       
       nav.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) {
                   nav.popToRootWindow({animated: true});
                   i = 0;
                   return;
               }
               nav.openWindow(createWindow(++i));
           });
           
           win.add(btn);
           return win;
       }
       
  2. Chee Kiat Ng 2016-06-28

    APPROVED!
  3. Harry Bryant 2016-09-15

    Verified as fixed. Tested On: iPhone 6 Plus 10.0.1 Device & Simulator iPhone 5S 9.3.5 Device Mac OSX El Capitan 10.11.6 Ti SDK: 6.0.0.v20160914165725 Appc Studio: 4.8.0.201609101003 Appc NPM: 4.2.8-6 App CLI: 6.0.0-42 Xcode 8.0 Node v4.4.7 *Closing ticket.*

JSON Source