[TIMOB-15078] iOS7: Modal Window is not closing correctly
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2013-09-12T19:53:35.000+0000 |
Affected Version/s | n/a |
Fix Version/s | 2013 Sprint 19, 2013 Sprint 19 API, Release 3.1.3, Release 3.2.0 |
Components | iOS |
Labels | ios7, module_window, qe-testadded, triage |
Reporter | Rafael Kellermann Streit |
Assignee | Vishal Duggal |
Created | 2013-09-07T13:13:10.000+0000 |
Updated | 2014-04-22T09:54:50.000+0000 |
Description
When I try to close a modal Window, it have no animation and put a **WARN** in console:
**The top View controller is not a container controller. This window will open behind the presented controller.**
Example code:
var win1 = Ti.UI.createWindow({
backgroundColor: "#FF00FF",
title: "Window 1"
});
var navWindow = Ti.UI.iOS.createNavigationWindow({
window: win1
});
navWindow.open();
win1.addEventListener("focus", function() {
alert("win1 focused");
});
win1.addEventListener("click", function() {
var buttonClose = Ti.UI.createButton({
title: "Close"
});
var win2 = Ti.UI.createWindow({
leftNavButton: buttonClose,
backgroundColor: "#FFFF00",
title: "Window 2"
});
var navWindow2 = Ti.UI.iOS.createNavigationWindow({
modal: true,
window: win2
});
navWindow2.open();
buttonClose.addEventListener("click", function() {
navWindow2.close();
});
});
master https://github.com/appcelerator/titanium_mobile/pull/4663 3_1_X https://github.com/appcelerator/titanium_mobile/pull/4664
FR passed for 3_1_X and PR merged. FR passed for master and PR merged.
Verified the Fix with: Appc Studio: 3.1.3.201309072408 Sdk:3.1.3.v20130909192251 CLI version : 3.1.2 Alloy : 1.2.2-beta MAC OSX: 10.8.4 XCode : 5beta6 Device: Ipad3(v7) Modal window now closes without warning.
Thanks! Could someone explain why modal window is not closing with animation? I don't get it.
Rafael: You need to specify {animated:true} in the your close() method.
Kosso: It doesn't work for me. It works to you?
Hi Rafael: Sorry. You're absolutely right. Now that I've tried to actually implement the new NavigationWindow for a modal window, I cannot get it to close with an animation, despite the setting.
Will verify and report back.
master - https://github.com/appcelerator/titanium_mobile/pull/4677 3_1_X - https://github.com/appcelerator/titanium_mobile/pull/4678
[~rafaelks],[~kosso] The problem is that the view of the navigationController was being prematurely detached (windowWillClose) and hence the close() functionality appeared to be non animated. The
animated
parameter is true by default for closing modal windows so you need not specify it. Have moved the detaching of views to windowDidClose method, which is called after the modal window is dismissed. Should be fixed after the above two PR's are merged. Thanks for catching that.Thank you for your fast feedback Vishal! :-) Waiting for new Titanium SDK build to test it.
Cannot reproduce the WARN message using the provided test sample and setting also all windows to modal. Verified as fixed. TiSDK 3.1.3.v20130912171547 Xcode 5 on iPad Mini 7 and iPhone iOS 7 simulator Closing.
As far as I can tell this issue still exists in 3.1.3 with NavigationWindows as mentioned by @kosso.
[~mrlundis] is this with the same sample code as shown above?
The example code above appears to work, but I'm experiencing the same issue with code generated through Alloy. At first glance the code appears to be comparable, but I have some more things going on though, like an opened keyboard, etc. I'll try to figure out what's causing this and try to extract another sample illustrating the issue.
If you can file the Alloy sample, that might be enough for us to go on.
I've done some more testing now, and it appears like the animation runs after all. The duration seemed to be extremely short however. Most likely because of to many other things happening on the main thread at the same time, delaying the start of the animation, causing it to appear almost instantaneous. I fixed the issue by waiting for the rendering of the view below to complete before closing the modal window.