[TIMOB-11538] iOS: SplitWindow loses 'visible' event
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2012-11-09T00:08:56.000+0000 |
Affected Version/s | Release 2.1.3 |
Fix Version/s | 2012 Sprint 23 API, 2012 Sprint 23 |
Components | iOS |
Labels | api |
Reporter | Nikhil Sharma |
Assignee | Sabil Rahim |
Created | 2012-10-19T00:15:06.000+0000 |
Updated | 2014-06-19T12:43:33.000+0000 |
Description
SplitWindow "visible" event is lost and you cannot remove the leftNavButton after changing the orientation to landscape.
Repo Steps
1. Run the below code in your app.js 2. Click "Launch SplitView" button. 3. It opens the splitWindow, click "Launch SplitView". 4. Now change the orientation of the simulator or device to landscape. 5. Click the "back" button. 6. You'll see "Master" leftNavButton.
var win0 = Ti.UI.createWindow({
navBarHidden : true,
backgroundColor : 'white'
});
var win1 = Ti.UI.createWindow({
backgroundColor : 'red'
});
var masterView = Ti.UI.createWindow({
backgroundColor : 'blue'
});
var nav = Ti.UI.iPhone.createNavigationGroup({
window : win1
});
var master = Ti.UI.iPhone.createNavigationGroup({
window : masterView
});
var splitwin = Ti.UI.iPad.createSplitWindow({
detailView : nav,
masterView : master
});
var win2 = Ti.UI.createWindow({
backgroundColor : 'green'
});
var masterView2 = Ti.UI.createWindow({
backgroundColor : 'purple'
});
var nav2 = Ti.UI.iPhone.createNavigationGroup({
window : win2
});
var master2 = Ti.UI.iPhone.createNavigationGroup({
window : masterView2
});
var splitwin2 = Ti.UI.iPad.createSplitWindow({
detailView : nav2,
masterView : master2
});
splitwin.addEventListener('visible', function(e) {
if (e.view == 'detail') {
e.button.title = "Master";
win1.leftNavButton = e.button;
} else if (e.view == 'master') {
win1.leftNavButton = null;
}
});
splitwin2.addEventListener('visible', function(e) {
if (e.view == 'detail') {
e.button.title = "Master";
win2.leftNavButton = e.button;
} else if (e.view == 'master') {
win2.leftNavButton = null;
}
});
var mainNavigation = Ti.UI.iPhone.createNavigationGroup({
window : win0
});
var backButton1 = Ti.UI.createButton({
title : 'Back'
});
backButton1.addEventListener("click", function(e) {
mainNavigation.close(splitwin);
});
masterView.leftNavButton = backButton1;
var backButton2 = Ti.UI.createButton({
title : 'Back'
});
backButton2.addEventListener("click", function(e) {
mainNavigation.close(splitwin2);
});
masterView2.leftNavButton = backButton2;
var launchButton2 = Ti.UI.createButton({
title : 'Launch SplitView'
});
launchButton2.addEventListener('click', function() {
mainNavigation.open(splitwin2);
});
win1.add(launchButton2);
var launchButton1 = Ti.UI.createButton({
title : 'Launch SplitView'
});
launchButton1.addEventListener('click', function() {
mainNavigation.open(splitwin);
});
win0.add(launchButton1);
var rootWin = Ti.UI.createWindow({
navBarHidden : true
});
rootWin.add(mainNavigation);
rootWin.open();
* The test case itself is invalid. Trying to open a splitwindow on top of another splitwindow inside a navigation group is a very bad UI design and cannot be supported. The
visible
event is fired by using the following UISplitViewControllerDelegate. ** - (void)splitViewController:(UISplitViewController *)svc willHideViewController:(UIViewController *)aViewController withBarButtonItem:(UIBarButtonItem *)barButtonItem forPopoverController:(UIPopoverController *)pc; ** - (void)splitViewController:(UISplitViewController *)svc willShowViewController:(UIViewController *)aViewController invalidatingBarButtonItem:(UIBarButtonItem *)barButtonItem; * These delegates are triggered when the detail view is shown and hidden as the orientation of the SplitWindow changes from Landscape to Portrait or when the popoverView is displayed. * These delegates are not triggered (iOS does not pass it on to us) for the first SplitView when the second SplitWindow changes its orientation and when you come back to the first SplitView the delegates gets all messed up about the current state of the UI. Which leads to inconsistent UI behavior. Marking ticket as invalid.Closing based on comments above