Keyboard “WillShow” and “WillHide” vs. Rotation

前端 未结 7 511
青春惊慌失措
青春惊慌失措 2021-01-31 04:56

I\'ve got a view controller listening for both UIKeyboardWillShowNotification and UIKeyboardWillHideNotification. The handlers for these notifications adjust various parts of th

7条回答
  •  别那么骄傲
    2021-01-31 05:09

    Here is my workaround:

    CGSize keyboardSize = [[[notification userInfo] objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue].size;
    float keyboardHeight = self.interfaceOrientation == UIInterfaceOrientationPortrait ? keyboardSize.height : keyboardSize.width;
    

    Hope this helps :)

提交回复
热议问题