Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Hide and show navbar through click event

$
0
0

I have a window, which shows the navbar by default. Now i'd like to hide the navbar by clicking the window, and then show it again by clicking the window once more.

For this i thought i could use the same event listener and with an if statement, but my code doesn't work:

// Create a window
    var viewFullWindow = Ti.UI.createWindow({
            title: 'test',
            fullscreen:true
        });
 
        // Create nav window to allow the use of a navigation menu
        var navWin = Ti.UI.iOS.createNavigationWindow({
            modal: true,
            window: viewFullWindow,
        });
 
    // Add Event Listener to hide and show navbar
        viewFullWindow.addEventListener('click', function(e){
            if ( e.source.navBarHidden == true) {
                    viewFullWindow.showNavBar();    
            } else {
                    viewFullWindow.hideNavBar();            
            }
        });
With this i'm able to hide the navbar by clicking once, but can't get it back by clicking again. e.source.navBarHidden only gives me the value 'undefined', so i must be doing something wrong.

What could i do to make my code work, or is there a better way to achieve my goal?

I'm very grateful for any help!


Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>