Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Change splitview leftNavButton text

This changes the text when I change orientation.

splitView.addEventListener('visible', function (e) {
  if (e.view == 'detail') {
    e.button.title = masterWindow.title;
    detailWindow.leftNavButton = e.button;
  }
  // hide it
  else if (e.view == 'master') {
    detailWindow.leftNavButton = null;
  }
});

But how can I change the text of the LeftNavButton when I click a button?

Thanks!

— asked August 31st 2010 by Chris Schultz
  • change
  • ipad
  • leftnavbutton
  • spitview
  • text
0 Comments

1 Answer

  • I've had this problem too and the solution to it was to set a new button on click. Check this out:

        // Buttons
        var fav_on = Titanium.UI.createButton({
            width: 26,
            height: 26,
            backgroundImage: 'res/images/but_fav.png'
        });
        var fav_off = Titanium.UI.createButton({
            width: 26,
            height: 26,
            backgroundImage: 'res/images/but_fav_sel.png'
        });
    
        // Button event listeners
        fav_on.addEventListener('click', function() {
            win.setRightNavButton(fav_off);
        });
        fav_off.addEventListener('click', function() {
            win.setRightNavButton(fav_on);
        });
    
    — answered August 31st 2010 by Richard Venneman
    permalink
    2 Comments
    • This does allow me to change the text of the button but I lose the functionality of the splitView menu. This there a way around this?

      — commented August 31st 2010 by Chris Schultz
    • Did you ever figure this out? I'm having the same problem.

      — commented October 2nd 2011 by Adam T
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.