Post

Replies

Boosts

Views

Activity

Reply to floating keyboard doesn't send keyboard notifications
Hi, I encountered a similar issue in my app: My app shows and hides an edit area (text field + other controls) when the keyboard hides and shows. The iPad floating and split keyboards presented a problem because as mentioned, they only send frame change events. I track the use of the traditional iPad keyboard by watching UIKeyboardWillShowNotification and UIKeyboardWillHideNotification events, and for floating and split keyboards, this is my solution when I get a UIKeyboardWillChangeFrameNotification notification: // n is NSNotification * from UIKeyboardWillChangeFrameNotification NSDictionary *keyboardInfo = [n userInfo]; CGRect keyboardFrameEndRect = [[keyboardInfo valueForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue]; NSUInteger animationCurveOption = [[keyboardInfo valueForKey:UIKeyboardAnimationCurveUserInfoKey] integerValue]; if (CGRectEqualToRect(keyboardFrameEndRect, CGRectZero) || // Floating keyboard is HIDING or BEING DRAGGED by the user keyboardFrameEndRect.origin.y >= self.view.frame.size.height) { // Split keyboard is moving off screen if (animationCurveOption != 0) { // When animation curve is zero, the keyboard is being hidden. (Otherwise, it's being moved) // TODO: FLOATING OR SPLIT KEYBOARD IS HIDING } } else { // TODO: FLOATING OR SPLIT KEYBOARD IS SHOWING }
Topic: UI Frameworks SubTopic: UIKit Tags:
Sep ’20