keyboardWillShow will only work from the second time on

ぐ巨炮叔叔 提交于 2019-12-09 20:12:30

问题


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)

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:

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

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?

来源:https://stackoverflow.com/questions/26004080/keyboardwillshow-will-only-work-from-the-second-time-on

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!