Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to move iPhone keyboard down like in Messages.app? [duplicate]

Possible Duplicate:
iMessage Style Receding Keyboard in an iOS App

In the iOS5 Messages app, you can slide your finger down on the keyboard to bring it up and down. This is also done in the iA Writer app in the AppStore. How can I do this in code, that is, access and modify the Y position of the UIKeyboard?

like image 228
Snowman Avatar asked Mar 22 '12 03:03

Snowman


People also ask

How do I get my iPhone keyboard back to the bottom of the screen?

Touch and hold the keyboard button in the lower-right corner of the keyboard. Slide your finger up to either Merge or Dock and Merge, then let go.

How do I change my keyboard keys back to normal on my iPhone?

Assign an alternative layout to a keyboardGo to Settings > General > Keyboard > Keyboards. Tap a language at the top of the screen, then select an alternative layout from the list.


2 Answers

Why reinvent the wheel? There are several open-source projects available that mimick the messages.app receding keyboard:

  1. http://cocoacontrols.com/platforms/ios/controls/madismissivetextview

  2. http://cocoacontrols.com/platforms/ios/controls/dakeyboardcontrol

  3. http://cocoacontrols.com/platforms/ios/controls/imessagekeyboardeffect

To name a few.

like image 98
CodaFi Avatar answered Oct 15 '22 09:10

CodaFi


There is no method to do this, but you may be able to modify the keyboard's frame directly like this:

UIWindow* tempWindow;

//Because we cant get access to the UIKeyboard throught the SDK we will just use UIView. 
//UIKeyboard is a subclass of UIView anyways
UIView* keyboard;

//Check each window in our application
for(int c = 0; c < [[[UIApplication sharedApplication] windows] count]; c ++)
{
    //Get a reference of the current window
    tempWindow = [[[UIApplication sharedApplication] windows] objectAtIndex:c];

    //Get a reference of the current view 
    for(int i = 0; i < [tempWindow.subviews count]; i++)
    {
        keyboard = [tempWindow.subviews objectAtIndex:i];

        if([[keyboard description] hasPrefix:@"(lessThen)UIKeyboard"] == YES)
        {
            //If we get to this point, then our UIView "keyboard" is referencing our keyboard.
        }
    }
}
like image 32
Patrick T Nelson Avatar answered Oct 15 '22 09:10

Patrick T Nelson