Friday, 28 September 2012

UIKeyBoard SplitView mode notification in iPAD

NSNotificationCenter is used to find the UIKeyBoard show or hide notification. From iOS5 can get the keyboard change notification (UIKeyboardDidChangeFrameNotification). Normally UIKeyboard have three modes are

  •        Dock
  •        UnDock
  •        Split

 Can find the keyboard show or hide notification by using name UIKeyboardWillHideNotification and UIKeyboardDidShowNotification for DOCK and UNDOCK mode.
In the split view, have to use UIKeyboardDidChangeFrameNotification to find the keyboard showor hide notification.

Register the notification in your  view controller to find keyboard changes in split view mode

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];

NSString *version = [[UIDevice currentDevice] systemVersion]; 
    float version_float = [version floatValue];

        if( version_float > 5.0])  //use notification if system version iOS5 and above
            [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShoworHide:) name:UIKeyboardDidChangeFrameNotification object:nil];

        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardDidShowNotification object:nil]; 

In the keyboardWillShoworHide method implementation have to check for the keyboard showing or hiding

BOOL wasKeyboardVisible;
- (void) keyboardWillShoworHide:(NSNotification *)aNotification
    NSDictionary* info = [aNotification userInfo];
    CGRect currentKbRect = [[info objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue];
    CGRect screenRect = [[UIScreen mainScreen] bounds];
    BOOL keyboardVisible = CGRectIntersectsRect(currentKbRect, screenRect);
    if (keyboardVisible && !wasKeyboardVisible) {
     //keyboard visible
    } else if (!keyboardVisible && wasKeyboardVisible) {
    //keyboard hidden
    wasKeyboardVisible = keyboardVisible;


  1. Hi There! Nice blog to read about the iPhone App Development , Iphone apps developers etc. It’s Really Helpful for people who interested in iOS and Android Application Development. Thanks for sharing such useful information with us.

  2. Hello my friend! I would like to tell you that this write-up is awesome, great written and include almost all important info. I would like to see a lot more articles like this.
    ios application development

  3. It's really informative! Thanks for the great article.
    At Hvantage Technologies, we are dedicated to providing online solutions: Web design & development, e-commerce solution, web promotion/SEO (search engine optimization ) and website maintenance services for your business. more details you should visit here once:

  4. Thankyou! Very well written article.
    Yberry Infosystem is a professional IT Development Company in India offering Mobile Application Development,Web Application Development. Ecommerce services, branding designing, graphics design as well as SEO solutions. Visit:

  5. Pretty article! I found some useful information in your blog, it was awesome to read, thanks for sharing this great content to my vision, keep sharing..
    iOS App Development Company
    Android App Development Company

  6. I wondered upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I’ll be subscribing to your feed and I hope you post again soon.

    Sms marketing
    Text message marketing
    Fitness SMS