problem with hide navbar

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

hello ,

I have a window that contains a tableview and when I click on the line I have a window that opens and contains the navbar

then I want to hide this navbar but I do not know how I do I try to use me navBarHidden but it also hides the navbar of the window containing my tableview me while I just want to hide the window of s 'opens after clicking on a line

here is the code that should open the window after the click event

var videoWindow = Titanium.UI.createWindow({
            title: '',
            //navBarHidden:true,
            tabBarHidden: true,
            backgroundColor: '#111'
        });

4 Answers

I believe I have seen this behavior as well. It seems like navBarHidden effects all windows in the navigation group. Its not ideal, but here's a basic example that shows how you can work around this. In particular, notice that in the button2 click handler I set win1.navBarHidden = false; again. A bit of a hack, but it works.

var win = Ti.UI.createWindow();
 
// first window in navigation group
var win1 = Ti.UI.createWindow({
    title:'win1'
});
var button = Ti.UI.createButton({
    title:'go to win2',
    width:100,
    height:40
});
button.addEventListener('click', function(e) {
    nav.open(win2);
});
win1.add(button);
 
// second window in naigation group
var win2 = Ti.UI.createWindow({
    title:'win2',
    navBarHidden:true
});
var button2 = Ti.UI.createButton({
    title:'back to win1',
    width:100,
    height:40
});
button2.addEventListener('click', function(e) {
    nav.close(win2);
 
    //This will show your nav bar again 
    win1.navBarHidden = false;
});
win2.add(button2);
 
// setup navigation group
var nav = Ti.UI.iPhone.createNavigationGroup({
    window:win1
});
 
win.add(nav);
win.open();

— answered 2 years ago by Tony Lukasavage
answer permalink
5 Comments
  • euhhh I hope I explained well

    I have buttons aps

    I have a window that contains a tableview

    when I click on one of these lines, there is a new window that Souvre, this window contains a navbar and I want to hide "is the navbar by default and contains the back button"

    — commented 2 years ago by sabrina sabrina

  • So you have a tableview in a window (we'll call win1) which has a navigation bar. When you click a row on that tableview, you open a new window (we'll call win2). In win2, you do NOT want the navigation bar to show up. But when you go back to win1, you want the navigation bar to still be there. Is this correct?

    If it is correct, the code I gave you above shows that you can simply add win1.navBarHidden = false; to whatever code sends you back to win1. So if, for example, you have a button in win2 that sends you back to win1, you can just add win1.navBarHidden = false; to the end of that button's click handler.

    — commented 2 years ago by Tony Lukasavage

  • yes I understand better

    but when I add win1.navBarHidden = false; in the code of the window 2

    win1 will not be recognized

    — commented 2 years ago by sabrina sabrina

  • Show 2 more comments

the window that contains the tabgroup

(function(){
 
    app.ui.createVodWindow = function(){
 
 
        var interServices = new app.model.InterServices();
 
        // create tab group
        var tabGroup = Titanium.UI.createTabGroup({
            barColor: 'black'
        });
 
        var winVod= Titanium.UI.createWindow({ 
            title:'',
            tabBarHidden: true,
            barColor:'black',
            backgroundColor:'white'
        });
 
        /*tab1*/
 
 
        var winR = Titanium.UI.createWindow({
            title: 'R',
            backgroundColor: 'white'
        });
 
 
        var tabR = Titanium.UI.createTab({
            icon: 'images/icons/recentes_on.png',
            title: 'R',
            window: winR
        });
 
 
        /*tab2*/
 
 
        var winE = Titanium.UI.createWindow({
            title: 'E',
            backgroundColor: 'white'
        });
 
        var tabE = Titanium.UI.createTab({
            icon: 'images/icons/emissions_on.png',
            title: 'E',
            window: winE
        });
 
 
        /*tab3*/
 
 
        var winT = Titanium.UI.createWindow({
            title: 'T',
            backgroundColor: 'white'
        });
 
        var tabT = Titanium.UI.createTab({
            icon: 'images/icons/themes_on.png',
            title: 'T',
            window: winT
        });
 
        tabGroup.addTab(tabR);
        tabGroup.addTab(tabE);
        tabGroup.addTab(tabT);
 
 
 
        return tabGroup;
 
    };
 
 
})();
the window should open after clicking on the line of which is in the tableview tab1
(function() {
 
    app.ui.createVideoRecentesTabGroup = function(videoR) {
 
        var interactivServices = new app.model.InteractivServices();
 
        var videoRecentes = videoR;
 
 
 
        var videoRecentesWindow = Titanium.UI.createWindow({
            title: '',
           // navBarHidden:true,
            tabBarHidden: true,
            backgroundColor: '#111',
 
        });
thank you

— answered 2 years ago by sabrina sabrina
answer permalink
2 Comments
  • I see no tableview anywhere in the code you are showing me. I cannot follow what you are trying to do that isn't covered by my original code sample.

    One note is that since you are using application namespace app.ui, it might be easiest to save that reference to win1 that I mentioned previously in something like app.ui.win1 = win1;

    — commented 2 years ago by Tony Lukasavage

  • Basically you need to be setting navBarHidden = true on any window before you open the window that should have no navigation bar. Also, before you go back to the original window, you need to set navBarHidden = false on any window.

    — commented 2 years ago by Tony Lukasavage

after you created videoWindow and before you open it set videoWindow.hideNavBar();

— answered 2 years ago by stefano di luca
answer permalink
3 Comments
  • the window is tableview WinRE I did not think you'll have need of his code but I post anyway

    I do not have my mac with me I can not do but I would try tomorrow and I'll keep you posted

    var winR = Titanium.UI.createWindow({
                title: 'Récentes',
                backgroundColor: 'white'
            });
     
     
            var tabR = Titanium.UI.createTab({
                icon: 'images/icons/recentes_off.png',
                title: 'R',
                window: winR
            });
     
     
            //Création de la liste tableau
            tableViewRe = Titanium.UI.createTableView({
                top:0
            });
            winR.add(tableViewR);
     
     
            //Début affichage des émissions
     
            function displayRecentes(xmlstr) {
                    var datar = [];
                //alert(xmlstr);
                    var xmldoc = Titanium.XML.parseString(xmlstr);
                    var doc = xmldoc.documentElement;
                    var recentes = doc.getElementsByTagName("EPISODES");
                    var items = recentes.item(0).getElementsByTagName("EPISODE");
     
                for (var c = 0; c < items.length; c++) {
                    var item = items.item(c);
     
                                var titre = item.getElementsByTagName("TITREPLAYER").item(0).text;
     
     
                     var titreF = (titre.length > 20) ? titre.substring(0,20)+"..." : titre;
                     var titreFM = titreF.toUpperCase();
                    /***********************/
     
                    var myDate = new app.model.MyDate();
                    var dateR = myDate.getDateString(item.getElementsByTagName("DATE_DEBUT").item(0).text);
     
     
     
                var ligneR = Ti.UI.createTableViewRow({
                        height:90,
                        backgroundColor:'#ffffff'
                        //selectedBackgroundColor:'#b40000'
                    });
                    var ligneRTitre = Ti.UI.createLabel({
                        text: titreFM,
                        color: '#cc0000',
                        textAlign:'left',
                        left: 135,
                        height:'auto',
                        width:'auto',
                        top:10,
                        font:{fontWeight:'bold',fontSize:12}
                    });
                    ligneR.add(ligneRTitre);
     
     
                    var ligneDate = Ti.UI.createLabel({
                        text: dateR,
                        color: '#808080',
                        textAlign:'left',
                        left: 135,
                        height:'auto',
                        width:'auto',
                        top:27,
                        font:{fontWeight:'bold',fontSize:12}
                    });
                    ligneR.add(ligneDate);
     
                    var item_image = Ti.UI.createImageView({
     
                        image:'http://...........fr/_public/files/m_vignettes/'+ vignette,
                        left:3,
                        top:0,
                        width:125,
                        height:90
     
                        });
     
                ligneR.add(item_image);
     
     
                    // arrow
                    var arrow_view = Ti.UI.createImageView({
                        image: 'images/right_arrow.png',
                        width: 33,
                        height: 33,
                        right: 2
                    });
                    ligneR.add(arrow_view);
     
     
     
                    // Add the row to the data
                    datar.push(ligneR);
                };
     
                tableViewRecentes.setData(datar);
            }
     
            interactivServices.callServiceEpisodes('best','1',displayRecentes);
    Thank you for your help I will try to see what I can do tomorrow

    — commented 2 years ago by sabrina sabrina

  • there is no error in this part it's just that I forgot the e

    //Création de la liste tableau
            tableViewR = Titanium.UI.createTableView({
                top:0
            });
            winR.add(tableViewR);

    — commented 2 years ago by sabrina sabrina

  • I did not catch

    when you said to use app.model.win1 = WIN1, I have said in my window WIN1 variables.js file that is in the app folder or the state with the other

    basically I have a folder that contains the app variables.js

    variables.js in there

    (function(){
     
     
        app.model.FilDatas =[];
     
     
        app.model.login= false;
     
        app.model.pseudo="";
        app.model.mail= "";
        app.model.image=[];
     
     
     
    })();
    Then as mentioned in my code I have a window that contains a win tabgroup

    one of the window contains a tabgroup tableiew " winR " and click on a row opens a window containing the navbar I want to hide "videoRecentesWindow"

    — commented 2 years ago by sabrina sabrina

Lik Stefano and I stated above, it is a simple matter of setting navBarHidden = true on your video window before you open it, and then setting navBarHidden = false on your original window before you go back to it. This will solve your problem. How you implement that within your existing navigation and app logic is up to you.

— answered 2 years ago by Tony Lukasavage
answer permalink
3 Comments
  • it does not work I do not know why

    can you give me the placement of navBarHidden in my code please, maybe I do not place properly but hey at least it does not work

    — commented 2 years ago by sabrina sabrina

  • I'd highly suggest looking again at my original example code to help you understand how you can solve your problem. It reduces the issue you are encountering down to a small, easy to understand example app. You can load it up on your device if you want to test it and see what I mean. Perhaps it would be beneficial on your part to reduce your code down to the smallest amount that still functions yet produces your problem. It will help you a great deal in understanding the solution.

    — commented 2 years ago by Tony Lukasavage

  • ok I'll try that

    thank you

    — commented 2 years ago by sabrina sabrina

Your Answer

Think you can help? Login to answer this question!