keyboardWillShow in IOS8 with UIKeyboardWillShowNotification

后端 未结 2 1757
灰色年华
灰色年华 2021-01-02 18:26

I am running the same code on an IOS 7 and IOS 8 device with differing results

Given a screen with two text fields

In IOS 7 if I touch the first field keyboa

相关标签:
2条回答
  • 2021-01-02 18:39

    best is to listen for keyboardWillChangeFrameNotification

    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillChangeFrameNotification:) name:UIKeyboardWillChangeFrameNotification object:nil];
    
    0 讨论(0)
  • 2021-01-02 18:41

    The reason is the difference in the keyboard. If the second field is a password field this means there is another keyboard under the hood. Therefore the notification is sent twice.

    0 讨论(0)
提交回复
热议问题