UIKeyboardFrameBeginUserInfoKey & UIKeyboardFrameEndUserInfoKey

In the Managing the Keyboard documentation:

UIKeyboardFrameBeginUserInfoKey The key for an NSValue object containing a CGRect that identifies the start frame of the keyboard in screen coordinates. These coordinates do not take into account any rotation factors applied to the window’s contents as a result of interface orientation changes. Thus, you may need to convert the rectangle to window coordinates (using the convertRect:fromWindow: method) or to view coordinates (using the convertRect:fromView: method) before using it.

UIKeyboardFrameEndUserInfoKey The key for an NSValue object containing a CGRect that identifies the end frame of the keyboard in screen coordinates. These coordinates do not take into account any rotation factors applied to the window’s contents as a result of interface orientation changes. Thus, you may need to convert the rectangle to window coordinates (using the convertRect:fromWindow: method) or to view coordinates (using the convertRect:fromView: method) before using it.

What is the meaning of start frame and end frame? What is the difference between them?

Answers


The start frame is where the keyboard is at the beginning of the animation: offscreen if the keyboard is being shown, or onscreen if the keyboard is being hidden. The end frame is where the keyboard will be at the end of the animation: vice versa. You can use the difference between them to write a single method that responds to both hiding and showing the keyboard.

Be sure also to use UIKeyboardAnimationCurveUserInfoKey and UIKeyboardAnimationDurationUserInfoKey when animating your view changes: that way, your animations and the OS's animations will be in sync.

Another hint: The documentation you linked to states, "The rectangle contained in the UIKeyboardFrameBeginUserInfoKey and UIKeyboardFrameEndUserInfoKey properties of the userInfo dictionary should be used only for the size information it contains. Do not use the origin of the rectangle (which is always {0.0, 0.0}) in rectangle-intersection operations". At least on the iPad on OS 3.2, this is not true. Both rects have the same size, while the origin, which is in screen coordinates, differs between the two.

You may find this question helpful: UIKeyboardBoundsUserInfoKey is deprecated, what to use instead?


Need Your Help

Copy a cell on one sheet and paste it on another VBA based on cell from each sheet matching

vba excel-vba copy-paste excel

I am hoping someone can help me out here. I have the below code returning an error message when I run it. I have a report that I import every hour into Sheet2. I need to take the value in cell D16 ...

Issue in Bluetooth pairing

bluetooth embedded windows-ce windows-embedded-compact hci

We are testing Bluetooth in WEC2013 with a USB based dongle from generic vendor on iMx6 platform. We are using the default HCI Transport layer provided with WEC2013 BSP.