Developer is using self custom NavBar. They were hoping there would be a way to show the master view as a popover in portrait.
1) Run simple test case at iPad simulator
2) Have 'contentView' set with either masterNav or master window
3) Click Popover twice. You can notice how the masterView gets bad positioned after couple of attempts.
var nav;
function openWindow(win) {
nav.openWindow(win);
}
var counter = 0;
var colors = ['red', 'green', 'blue', 'yellow', 'pink'];
var barcolors = ['teal', 'magenta', 'maroon', 'lightgray', 'purple'];
function genWindow() {
var win = Ti.UI.createWindow({
backgroundColor : 'white',
wincount : counter
});
win.addEventListener('click', function() {
openWindow(genWindow());
});
win.addEventListener('open', function(e) {
var count = e.source.wincount;
if ( count = count % 5)
;
Ti.API.info('WIN OPEN ' + e.source.wincount);
e.source.title = 'WINDOW ' + e.source.wincount;
e.source.backgroundColor = colors[count];
e.source.barColor = barcolors[count];
counter++;
});
win.addEventListener('close', function(e) {
Ti.API.info('WIN CLOSE ' + e.source.wincount);
counter--;
});
win.addEventListener('focus', function(e) {
Ti.API.info('WIN FOCUS ' + e.source.wincount);
});
win.addEventListener('blur', function(e) {
Ti.API.info('WIN BLUR ' + e.source.wincount);
});
return win;
}
function genNav() {
counter = 0;
nav = Ti.UI.iOS.createNavigationWindow({
window : genWindow(),
backgroundColor : 'transparent'
});
nav.addEventListener('open', function(e) {
Ti.API.info('NAV OPEN');
});
nav.addEventListener('focus', function(e) {
Ti.API.info('NAV FOCUS');
});
nav.addEventListener('blur', function(e) {
Ti.API.info('NAV BLUR');
});
}
var detail = Ti.UI.createWindow({
backgroundColor : 'white'
});
var label1 = Ti.UI.createLabel({
text : 'Detail View'
});
detail.add(label1);
var btn = Ti.UI.createButton({
top : 40,
title : 'OPEN POPOVER'
});
btn.addEventListener('click', function() {
var popover = getPopover();
popover.show({
view : btn
});
});
detail.add(btn);
//Navigation Window
var detailNav = Ti.UI.iOS.createNavigationWindow({
window : detail
});
var master = Ti.UI.createWindow({
backgroundColor : 'gray'
});
var label2 = Ti.UI.createLabel({
text : 'Master View'
});
master.add(label2);
var masterNav = Ti.UI.iOS.createNavigationWindow({
window : master
});
var splitWin = Ti.UI.iPad.createSplitWindow({
detailView : detailNav,
masterView : masterNav,
showMasterInPortrait: false
});
splitWin.addEventListener('visible', function(e) {
if (e.view == 'detail') {
e.button.title = "Master";
detail.leftNavButton = e.button;
} else if (e.view == 'master') {
detail.leftNavButton = null;
}
});
splitWin.open();
function getPopover() {
genNav();
var popover = Ti.UI.iPad.createPopover({
width : 400,
height : 400,
//TC1: navigationWindow opens correctly
//contentView : nav
//TC2: Clicking "OPEN POPOVER" twice gets masterView bad positioned
contentView : masterNav
//TC3: On attempt to set master window generates error below
//contentView: master
/*
[ERROR] : message = "The content view controller argument must be
the root of its associated view controller hierarchy.";
*/
});
popover.addEventListener('hide', function(e) {
nav = null;
});
return popover;
}
Closing as invalid, iOS doesn't allow to do this