Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6798945
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:47:25+00:00 2026-05-26T18:47:25+00:00

I have a UISearchBar on a bottom toolbar. The problem is the keyboard covers

  • 0

I have a UISearchBar on a bottom toolbar. The problem is the keyboard covers it up once you click on it. I was trying to think of ways around this. I tried adding it to the top, but since I’m using a UINavigationController, I’m getting some unexpected behavior. (Like the UISearchBar in the customView for the rightBarButtonItem lengthens once the keyboard is on screen and doesn’t return to its original size, and the entire NavigationBar goes off the screen when the keyboard is pressed so you cannot even see what you are typing in that situation either.)

So as a workaround, I was thinking I could have the systemIcon for search in the lower right corner of my toolbar, and then when the keyboard pops up, the searchbar could be part of the keyboard, and then you could see what you type. Does anyone know how I would do that? Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T18:47:26+00:00Added an answer on May 26, 2026 at 6:47 pm

    Beryllium is on the right track. here is some code that will help you get there.

    1. Move the search bar off the screen so it cant be seen until the button is pushed
    2. Register for keyboardWillShow notifications
    3. when button is pushed, make the searchbar “becomeFirstResponder”
    4. move the search bar from the bottom (out of view) to above the keyboard (in view)

    //

    //in viewDidLoad register for notifications
     [self registerForKeyboardNotifications];
    
    //in viewdidload hide the search bar
    CGRect rect = searchBar.frame;
    rect.origin.y = 480;
    searchBar.frame = rect;
    
    //own function register for keyboardwillshow
    - (void)registerForKeyboardNotifications
    {
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];
    }
    
    
    //when button is pushed move the searchbar into view. you may have to play with the pixels a bit to make sure it lands on top, and flush
    
    - (void)keyboardWillShow:(NSNotification*)aNotification
    {
    
    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:0.3];
    CGRect rect = searchBar.frame;
    rect.origin.y = 180; //adjust the 180 to get it to land where you want
    searchBar.frame = rect;
    [UIView commitAnimations];
    }
    
    
    //own function hide the search bar when the keyboard is dismissed
    - (void)keyboardWillHide:(NSNotification*)aNotification
    {
    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:0.3];
    CGRect rect = searchBar.frame;
    rect.origin.y = 480;
    searchBar.frame = rect;
    [UIView commitAnimations];
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a UISearchBar and on the delegate method I hide the keyboard when
I have a search functionality using UISearchBar that occurs on-the-fly, so I think it
I have a class that conforms to UISearchDisplayDelegate and contains a UISearchBar. This view
I am trying to add a UISearchbar to table header view. I have the
I have a UISearchBar . I want the the keyboard to go away as
I have a UISearchBar which uses the UIScopeBar, and I am trying to get
How do I find out if the keyboard is up? I have a UISearchbar
I have a UISearchBar below a header-view. This header is 64px hight. If the
I have a UISearchBar that behaves normally - the keyboard goes away if I
I have placed a UISearchBar in my UITableView.tableHeaderView. However it covers the searchBar by

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.