Modal Window open another Modal Window, how?

You must Login before you can answer or comment on any questions.

Hi,

I'm trying to open a modal window by another modal window. But the iOS really can't do this. Someone how know to do this?

I need to open a modal window by another modal window. See what I'm trying here:

var win = Ti.UI.createWindow({
    backgroundColor:"green"
});
win.open();
 
var winBase1 = Ti.UI.createWindow({
    zIndex:10,
    navBarHidden:true,
    backgroundColor:"yellow",
    modal:true
});
var nav1 = Ti.UI.iPhone.createNavigationGroup({
    window:Ti.UI.createWindow({
        backgroundColor:"yellow"
    })
});
winBase1.add(nav1);
winBase1.open();
 
setTimeout(function() {
    var winBase2 = Ti.UI.createWindow({
        backgroundColor:"blue",
        zIndex:100,
        modal:true
    });
    var nav2 = Ti.UI.iPhone.createNavigationGroup({
        window:Ti.UI.createWindow({
            backgroundColor:"blue"
        })
    });
    winBase2.add(nav2);
    winBase2.open();
}, 1000);
When I try to do this, I have this error message:

2011-12-23 14:58:02.336 Modals[30420:17903] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Application tried to present modally an active controller <UIViewController: 0xa3ab760>.'

1 Answer

It's not a bug. In iOS you can not open a child modal window from another parent modal window.

— answered 2 years ago by Yogin Bhungalia
answer permalink
7 Comments
  • In the iOS, you can to open a modal window by another modal window. See the example in the Foursquare app, try to make a checkin and add a new point.

    In the Obj-C it works like this:

    [self presentModalViewController...]

    — commented 2 years ago by Felipe Kellermann

  • When i tried achieving the same i was not able to find any solution so i replied you what i was knowing and i don't know a single coding in xcode.

    — commented 2 years ago by Yogin Bhungalia

  • Yes. I search so much too, but I didn't find any solution to this problem. :-(

    — commented 2 years ago by Felipe Kellermann

  • Show 4 more comments

Your Answer

Think you can help? Login to answer this question!