无法关闭 navWindow 的根 window。尝试关闭模式时改为关闭此 window

Can not close root window of the navWindow. Close this window instead when trying to close modal

即使在关闭模式后,我仍收到以下错误。

Can not close root window of the navWindow. Close this window instead when trying to close modal

下面是我的代码

var mainWindow = Ti.UI.createWindow({
  title : 'My Title',
    barColor : topBarColor,
    backgroundColor : 'white'
  });

var modalWindow = Ti.UI.createWindow({
  modal : true,
  barColor : topBarColor,
  backgroundColor : 'pink'
});

var navWin = Ti.UI.iOS.createNavigationWindow({
  modal: true,
  window: modalWindow
});

navWin.open();

我就是这样关闭 windows

mainWindow.close();
modalWindow.close();

您必须将 navigationWindow 传递给模式:

var navWin = Ti.UI.iOS.createNavigationWindow({
        modal: true,
        window: modalWindow
});

modalWindow.navWin = navWin;
navWin.open();

然后像这样关闭它:

modalWindow.navWin.close();