hide and show left navigation bar button on demand in iOS-7
NickName:learner Ask DateTime:2014-08-02T03:44:35

hide and show left navigation bar button on demand in iOS-7

I added my left navigation bar button using the storyboard. but I want it to hide when I first load the screen. And then in response to something else, I want it to show. The navigation bar has a method for hiding the back button. But there is no method for hiding/showing the left button. Is there a simple way for doing this? Or do I have to use two methods: the hiding method creates an empty button and the showing method creates the correct button? The button in question is just the Add template that iOS provides (which makes it easy to just use the one in the storyboard than to create my own).

Copyright Notice:Content Author:「learner」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/25087585/hide-and-show-left-navigation-bar-button-on-demand-in-ios-7

Answers
learner 2014-08-01T20:03:00

Here is how I solved it\n\n-(void) hideAndDisableRightNavigationItem\n{\n [self.navigationItem.rightBarButtonItem setTintColor:[UIColor clearColor]];\n [self.navigationItem.rightBarButtonItem setEnabled:NO];\n}\n\n-(void) showAndEnableRightNavigationItem\n{\n [self.navigationItem.rightBarButtonItem setTintColor:[UIColor blackColor]];\n [self.navigationItem.rightBarButtonItem setEnabled:YES];\n}\n",


LHIOUI 2016-01-07T10:24:40

Swift version of @learner answer\n\nfunc hideAndDisableRightNavigationItem (){\n self.navigationItem.rightBarButtonItem?.enabled = false\n self.navigationItem.rightBarButtonItem?.tintColor = UIColor.clearColor()\n}\n\nfunc showAndEnableRightNavigationItem(){\n self.navigationItem.rightBarButtonItem?.enabled = true\n self.navigationItem.rightBarButtonItem?.tintColor = UIColor. blackColor()\n}\n",


More about “hide and show left navigation bar button on demand in iOS-7” related questions

hide and show left navigation bar button on demand in iOS-7

I added my left navigation bar button using the storyboard. but I want it to hide when I first load the screen. And then in response to something else, I want it to show. The navigation bar has a m...

Show Detail

How to hide left button of the navigation bar?

How do I hide left button of the navigation bar I've created in the Interface Builder? In the Interface Builder, there is a check box Hidden for it, but I am not able to set it programmatically (

Show Detail

ios hide text of left navigation button

I need to show only arrow button and hide text of left navigation button. According to this link, I can do like this. But if I do like that, slide to go back feature will be destroyed. self.

Show Detail

How to show Navigation Left bar button?

Developing an iOS application with Xcode ver 9.3, Swift. Navigation Left bar button does not appear. Could you tell me how to show Left bar button? When I tried the button on the right side with ...

Show Detail

Flutter: Hide and show status bar an navigation bar with the help of Floating Action button?

I want to know how will I hide and show the status bar and navigation bar with the help of a Floating action button how can I do this? By default, the status bars will show but when clicking on the

Show Detail

On-demand hide or show block in responsive view with CSS

I have always found replies to my questions here even before I asked them. Right now I am facing a problem regarding the responsive adaption of a site I created (www.cichlidae.com) that led me to p...

Show Detail

Hide/show status and navigation bar on

I am searching for hours, but nothing found. I just want to hide/show status and navigation bar when I hit the screen, like android gallery. // Hide status bar getWindow().addFlags(WindowManager.

Show Detail

Navigation bar - show, hide home and recents buttons

Is it possible to hide only home and recents button on system navigation bar ? I see that there is only possibility to show/hide whole system navigation bar, but I would like to stay with only back

Show Detail

View Frame Changes On Hide/Show Navigation Bar?

In My Application, I have Navigation Controller with root view controller. To show/hide navigation bar which works fine. - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { B...

Show Detail

android detect Samsung Galaxy S8 navigation bar hide or show programmatically

On some devices such as Samsung S8, navigation bar can be hide or show, that's a question in some condition. Samsung S8's navigation bar can be hide or show by click left bottom button I didn't find

Show Detail