keyboardWillShow will only work from the second time on

I have a UITextView that I need to move up when the user focuses on it.

In the simulator I have set up 2 keyboards (English,Greek)

  • How to require a minimum text length in UITextField before enabling keyboard return key
  • How to Dismiss keyboard when touching away across the entire app
  • How to display UIView over keyboard in iOS
  • Allow only Numbers for UITextField input
  • display soft keyboard (iPad) when is connected a bluetooth input device
  • Close iOS Keyboard by touching anywhere using Swift
  • Within keyboardWillShow function I change the UITextView’s height to be less than the existing one, as in

    self.page_text.frame = CGRectMake(self.page_text.frame.origin.x, self.page_text.frame.origin.y, self.page_text.frame.width, (notification.userInfo?[UIKeyboardFrameEndUserInfoKey] as NSValue).CGRectValue().origin.y - 180)

    The problem is that only each first time I focus on the text view the keyboard appears but the UITextView’s height does not change:

    first keyboard appearance

    After that first time, each time I change the keyboard’s language the text view behaves as expected.

    second time appearance

    Why could this be happening?

    The project can be found here

    PS: I noticed that if the two keyboards are in the same language (ex US English and UK English), the height never changes. How strange is that?