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 6223071
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T08:25:29+00:00 2026-05-24T08:25:29+00:00

How do I find out if the keyboard is up? I have a UISearchbar

  • 0

How do I find out if the keyboard is up?

I have a UISearchbar instance which becomes the first responder.

When the keyboard appears a notification is sent out as part of the API, however I don’t want to respond to this right away. I could record this in a boolean state, but that seems clunky. I’d like to know if there is a “getter” some where I can call to find out.

  • 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-24T08:25:30+00:00Added an answer on May 24, 2026 at 8:25 am

    This is how I do it:

    KeyboardStateListener.h

    @interface KeyboardStateListener : NSObject {
        BOOL _isVisible;
    }
    + (KeyboardStateListener *) sharedInstance;
    @property (nonatomic, readonly, getter=isVisible) BOOL visible;
    @end
    

    KeyboardStateListener.m

    #import "KeyboardStateListener.h"
    
    static KeyboardStateListener *sharedObj;
    
    @implementation KeyboardStateListener
    
    + (KeyboardStateListener *)sharedInstance
    {
        return sharedObj;
    }
    + (void)load
    {
        NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
        sharedObj = [[self alloc] init];
        [pool release];
    }
    - (BOOL)isVisible
    {
        return _isVisible;
    }
    - (void)didShow
    {
        _isVisible = YES;
    }
    - (void)didHide
    {
        _isVisible = NO;
    }
    - (id)init
    {
        if ((self = [super init])) {
            NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
            [center addObserver:self selector:@selector(didShow) name:UIKeyboardDidShowNotification object:nil];
            [center addObserver:self selector:@selector(didHide) name:UIKeyboardWillHideNotification object:nil];
        }
        return self;
    }
    
    -(void) dealloc {
        [[NSNotificationCenter defaultCenter] removeObserver:self];
        [super dealloc];
    }
    
    @end
    

    Then use this to figure out the rest:

    KeyboardStateListener *obj = [KeyboardStateListener sharedInstance];
    if ([obj isVisible]) {
        //Keyboard is up
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I find out, which keyboard layout the user of my ruby application
I would like to find out which version of an executable the CMD shell
I want to find out the position of an element which is in iframe.
In Cocoa/ Objective C I need to be able to programmatically find out which
I'm looking to find out how to automatically set the keyboard focus to a
How can I find out if an NSWindow is active? i.e. if I have
i need to find out automationid for key board values? how to send keystrokes
Find out the time complexity (Big Oh Bound) of the recurrence T(n) = T(⌊n⌋)
To find out the start command for mysqld (using a mac) I can do:
I find out how to replace the busy cursor here: http://livedocs.adobe.com/flex/3/html/cursormgr_3.html However, how do

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.