NappAppearance icon indicating copy to clipboard operation
NappAppearance copied to clipboard

Globally Set NavBarColor in function

Open justadaniel opened this issue 11 years ago • 1 comments

Hi, I was wondering, is there an easy way to globally set the Navigation Bar barColor and/or tintColor in a function?

Example:

button.addEventListener('click', function() {
        NappAppearance.setGlobalStyling({
                navBar: {
                        barColor:'#ff0000',
                        tintColor:'#ffffff'
                }
        });
});

justadaniel avatar Nov 16 '13 00:11 justadaniel

In your Ti app, using the CommonJS convention, all your windows should basically inherit basic properties from the same "win.js" file. So, something like this in your win.js file

module.exports = function(title) {
    return Ti.UI.createWindow({
        barColor: "#ff0000",
        tintColor: "white",
        title: title
    });
});

and then where ever you need a need a window, you can simply do:

var newWin = require('win')("Photo Gallery");

//If you need to change the bar color?
newWin.barColor = "#00ff00";

newWin.open()

dezinezync avatar Nov 16 '13 02:11 dezinezync