Comment faire pour déplacer le keyboard de l'iPhone comme dans Messages.app?

Dupliquer possible:
Clavier iMessage Style en retrait dans une application iOS

Dans l'application Messages iOS5, vous pouvez faire glisser votre doigt vers le bas sur le keyboard pour le faire monter et descendre. Ceci est également fait dans l'application iA Writer dans l'AppStore. Comment puis-je faire cela dans le code, c'est-à-dire, accéder et modifier la position Y du UIKeyboard?

Pourquoi réinventer la roue? Il existe plusieurs projets open-source disponibles qui imitent le keyboard recules de messages.app:

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

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

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

Pour en nommer quelques-uns.

Il n'y a pas de méthode pour cela, mais vous pouvez modifier le cadre du keyboard directement comme ceci:

 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. } } }