Keyboard hides TabBar

I am working in a TabBar application. One view has a UISearchBar, and when clicked, a keyboard appears.

The problem is that the keyboard hides the tab.

Do you know how to solve it?

+7
source share
3 answers

As far as I know, you cannot move the keyboard .. so try using transform to move the tab above the keyboard

Taken from here

Another link

0
source

It has been a while since this was set, but for the sake of documentation it says: First, sign up for NSNotificationCenter to receive a notification about the keyboard:

-(void) viewWillAppear:(BOOL)animated { [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillToggle:) name:UIKeyboardWillShowNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillToggle:) name:UIKeyboardWillHideNotification object:nil]; } 

don't forget to unsubscribe

 - (void)viewWillDisappear:(BOOL)animated { [self.view endEditing:YES]; [super viewWillDisappear:animated]; [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillShowNotification object:nil]; [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillHideNotification object:nil]; } 

Then we implement the function that will be called by the notification center:

 - (void) keyboardWillToggle:(NSNotification *)aNotification { CGRect frame = [[[self tabBarController] tabBar] frame]; CGRect keyboard = [[aNotification.userInfo valueForKey:@"UIKeyboardFrameEndUserInfoKey"] CGRectValue]; frame.origin.y = keyboard.origin.y - frame.size.height; [UIView animateWithDuration:[[aNotification.userInfo valueForKey:@"UIKeyboardAnimationDurationUserInfoKey"] floatValue] animations:^ { [[[self tabBarController] tabBar] setFrame:frame]; }]; 

This will animate the TabBar with a keyboard step and hold it on top.

+13
source

I solved this by showing a custom keyboard instead of a native uikeyboard .

Download a sample project from this github .

Set the keyboard to the desired keyboard, either this number or words.

Then place the uibuttons under the user keyboard using tablet controllers such as the image as shown below. Try this (future visitors), this may solve the problem.

enter image description here

0
source

All Articles