Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-14564] iOS: Hiding rightNavButton using properties or methods doesn't work

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionInvalid
Resolution Date2017-05-02T22:06:08.000+0000
Affected Version/sn/a
Fix Version/sn/a
Componentsn/a
Labelsbutton, navbar, navbutton, navigation, window
ReporterMatej
AssigneeEric Merriman
Created2013-07-15T18:56:04.000+0000
Updated2017-06-15T18:54:12.000+0000

Description

There are few functions for hide NavBarButton ,but any one doesn't work.
var button = Ti.UI.createButton({
	systemButton: Ti.UI.iPhone.SystemButton.TRASH
});

var win = Titanium.UI.createWindow({
	title: "Just window",
    rightNavButton: button
});
 
var navGroup = Ti.UI.iPhone.createNavigationGroup({
    window: win
});
 
var mainWin = Ti.UI.createWindow();
mainWin.add(navGroup);
mainWin.open();

// === === ===
button.hide();
button.visible = false;
win.rightNavButton.visible = false;
win.rightNavButton.hide();

Comments

  1. Eduardo Gomez 2013-07-15

    You actually need to set the value of the [rightNavButton property](http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.UI.Window-method-setRightNavButton) not to change the view to show in the [right nav bar](http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.UI.Window-property-rightNavButton) area. Simple sample demonstrates the issue:
       var button = Ti.UI.createButton({
           systemButton: Ti.UI.iPhone.SystemButton.TRASH
       });
        
       var win = Titanium.UI.createWindow({
           title: "Just window",
           rightNavButton: button
       });
         
       var navGroup = Ti.UI.iPhone.createNavigationGroup({
           window: win
       });
         
       var mainWin = Ti.UI.createWindow();
       mainWin.add(navGroup);
       mainWin.open();
        
       // === === ===
       //button.hide();
       //button.visible = false;
       //win.rightNavButton.visible = false;
       //win.rightNavButton.hide();
       setTimeout(function(){
       	win.setRightNavButton(null);	
       }, 3000);
       
  2. Matej 2013-07-15

    Yes I know about it. But if I want to show button than I have to make something like this:
       var button = rightNavButton;
       // HIDE
       win.setRightNavButton(null);
       
       //SHOW
       win.rightNavButton = button;
       
    I think that is better to fix problem showed above... Thanks
  3. Eduardo Gomez 2013-07-16

    Then can you please state why the following logic wouldn't work for your app? https://github.com/appcelerator/KitchenSink/blob/master/Resources/ui/handheld/ios/baseui/window_navbar.js#L198
  4. Matej 2013-07-16

    It does work and I am already using something like this. Problem is that I want to hide/show button ,but if I want to make this first I have to make this, this and this. There is property/function so why doesn't work? This is absolutely terrible. Milion of bugs, optimization, workaround... I didn't see worse source code like code in my app. Please make life of developer easier and fix this issue. Thank you ;)
  5. Fokke Zandbergen 2013-09-11

    [~egomez] The proposed workaround maybe 'fine' for classic Titanium, but if you use Alloy this requires you to either have the button as a second or next top-level element or to have it there as a starter and remove it later. Agreeing with [~sko] that this is a terrible way to work. I suggest getting it fixed ;)
  6. Lee Morris 2017-05-02

    Resolving ticket as Invalid as there is now a new version of Kitchen Sink available and we no longer support the version which relates to this ticket.
  7. Rob Trueman 2017-06-15

    How does that fix the issue of showing/hiding a navigation button in Alloy? I'm using 6.1.0GA and still cannot call the .hide() method on a navigation button to hide it.
  8. Lee Morris 2017-06-15

    [~rtrueman] Hi Rob, please could you open a new ticket on this?

JSON Source