0

enter image description here

I was wondering on how to get the y position of the input accessory view on the keyboard. Can anyone help?

Abdullah Shafique
  • 6,878
  • 8
  • 35
  • 70
  • Hi Abdullah, your question [has already been asked and answered before](http://stackoverflow.com/questions/10955888/ios-keyboard-location-and-orientation). You can get the keyboard position by registering for the `UIKeyboard*` notifications. – Michael Dautermann Jul 09 '13 at 16:44
  • I tried the solution but I don't get the input accessory view y position. – Abdullah Shafique Jul 09 '13 at 16:46

2 Answers2

2

Setup a UITextViewDelegate and implement the textViewDidBeginEditing: delegate method. When it is called, access the inputAccessoryView property of the text view. Then look at the view's frame property.

The frame is likely to be in window coordinates. You may need to covert the frame from window coordinates to another view's coordinates depending on your needs. See the UIView convertRect:... methods for details.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
0

Here is Apple's documentation on managing the keyboard: http://developer.apple.com/library/ios/#documentation/StringsTextFonts/Conceptual/TextAndWebiPhoneOS/KeyboardManagement/KeyboardManagement.html

Observe the UIKeyboardDidShowNotification notification and query the userInfo dictionary for the UIKeyboardFrameEndUserInfoKey to get an NSValue containing the CGRect of the keyboard.

More on UIKeyboardDidShowNotification here: http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIWindow_Class/UIWindowClassReference/UIWindowClassReference.html#//apple_ref/c/data/UIKeyboardDidShowNotification

Nicholas Hart
  • 1,734
  • 13
  • 22