[TIMOB-14564] iOS: Hiding rightNavButton using properties or methods doesn't work
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | Critical |
| Status | Closed |
| Resolution | Invalid |
| Resolution Date | 2017-05-02T22:06:08.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | n/a |
| Components | n/a |
| Labels | button, navbar, navbutton, navigation, window |
| Reporter | Matej |
| Assignee | Eric Merriman |
| Created | 2013-07-15T18:56:04.000+0000 |
| Updated | 2017-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();
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);Yes I know about it. But if I want to show button than I have to make something like this:
I think that is better to fix problem showed above... ThanksThen 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
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 ;)
[~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 ;)
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.
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.
[~rtrueman] Hi Rob, please could you open a new ticket on this?