Hide/Show Navigation Bar or Hide/Show Text on it

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

Hi.!!

I'm having trouble here with the Navigation Bar in the app. Want to either display text on the Navigation Bar or hide it totally (since it doesn't show any text on it). The code being used right now (as shown below), shows either text such as {object Object} on the Navigation Bar with/out the Back button, or it shows nothing at all on the gray colored Navigation Bar. Kindly Help!

function ApplicationTabGroup()
{
    //create module instance
    var mainTabGroup = Ti.UI.createTabGroup({ size:50}),
        Home = require('ui/common/tabs/Home'),
        RunningNow = require('ui/common/tabs/RunningNow'),
        NextChange = require('ui/common/tabs/NextChange'),
        ComingSoon = require('ui/common/tabs/ComingSoon'),
        Xtraz = require('ui/common/tabs/Xtraz');
 
    //create app tabs
    var homeWin = new Home(L('AppTree CINEMAS!'));
    var runningNowWin = new RunningNow(L('Movies Running NOW!'));
    var nextChangeWin = new NextChange(L('Movies Next Week!'));
    var comingSoonWin = new ComingSoon(L('Movies Coming Soon!'));
    var xtrazWin = new Xtraz(L('Xtraz'));
 
    var homeTab = Ti.UI.createTab({ title:'Home', window: homeWin });
    homeWin.containingTab = homeTab;
    mainTabGroup.addTab(homeTab);
 
    var runningNowTab = Ti.UI.createTab({ title:'Running Now', window: runningNowWin });
    runningNowWin.containingTab = runningNowTab;
    mainTabGroup.addTab(runningNowTab);
 
    var nextChangeTab = Ti.UI.createTab({ title:'Next Change', window: nextChangeWin });
    nextChangeWin.containingTab = nextChangeTab;
    mainTabGroup.addTab(nextChangeTab);
 
    var comingSoonTab = Ti.UI.createTab({ title:'Coming Soon!', window: comingSoonWin });
    comingSoonWin.containingTab = comingSoonTab;
    mainTabGroup.addTab(comingSoonTab);
 
    var xtrazTab = Ti.UI.createTab({ title:'xtraz', window: xtrazWin });
    xtrazWin.containingTab = xtrazTab;
    mainTabGroup.addTab(xtrazTab);
 
    //mainTabGroup.setActiveTab(4);
    return mainTabGroup;
};
module.exports = ApplicationTabGroup;

PS: Tried all platforms - Android Emulator, iPhone Simulator, Web App Browser, running in Safari in the iPhone, etc.

1 Answer

Hi, i see in your code and found that you are setting title for TAB when you create. thats why it shows up the title for once and then blank NAV BAR. try setting the window title which each tab is going to contain. that will present the NAV BAR with title.

is this solved your problem?

— answered 8 months ago by Ashish Nigam
answer permalink
2 Comments
  • Hi Ashish - thanks for the reply, but it didn't solve the problem!

    Firstly, tell me how exactly to set the window title - 'cuz I tried the following but to no avail:

    homeTab.window.title = 'Window Title';

    &

    var homeTab = Ti.UI.createTab(
    {
        // removed the title            title:'Home',
        window: homeWin
    });

    and just experimented,

    var homeTab = Ti.UI.createTab(
    {
        window:{ title:'Home', window:homeWin }
    });

    Secondly, in any case, I'm setting the title of the window in the next class (I mean ui/common/tabs/Home), as follows:

    function Home(windowTitle)
    {
        var thisWindow = Ti.UI.createWindow({ title:windowTitle, backgroundImage:'images/backgrounds/bg_tribal.jpg' });
        ...
        ...
        return thisWindow;
    };
    module.exports = Home;
    And, last but not the least, what's the problem if there's no error shown but just that the iPhone simulator exits.!?

    Thanks! (for eating your head) :)

    — commented 8 months ago by Pushpinder Nayyar

  • Hi, for setting the window title, it seems like you are doing right. i will look more closely when i get some time and let you know.

    for the second question, i think it happens some time when you leave the simulator for a while and start working again. there might be some other cause also.

    to investigate further, open your build X-Code project in X-Code and try to figure out.

    — commented 8 months ago by Ashish Nigam

Your Answer

Think you can help? Login to answer this question!