forum

Home / DeveloperSection / Forums / How to Toggle UIBarButtonItem on KeyboardDidShow

How to Toggle UIBarButtonItem on KeyboardDidShow

Anonymous User217613-Oct-2014

Purpose: I am attempting to toggle the "Save" UIBarButtonItem with the "Hide Keyboard" UIBarButtonItem whenever the Keyboard appears (and then do the opposite when the "Hide Keyboard" button is clicked).

So far I have created two UIBarButtonItems and connected them both to Interface Builder.

@property (weak, nonatomic) IBOutlet UIBarButtonItem *saveButton;

@property (weak, nonatomic) IBOutlet UIBarButtonItem *hideKeyButton;

This is the code I have setup so far in my main:

- (void)keyboardDidShow:(NSNotification *)aNotification {
            // Show HideKey Button
            // Hide Save Button
        }
 
        - (void)keyboardWillHide:(NSNotification *)aNotification {
            // Show Save Button
            // Hide HideKey Button
        }

On Interface Builder, the Save button is present by default. Programmatically, how do I show the HideKey button and Hide the Save button? Thanks.


Updated on 13-Oct-2014
I am a content writter !

Can you answer this question?


Answer

2 Answers

Liked By