Check for split keyboard

后端 未结 4 1497
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-13 11:08

As many of you know iOS 5 introduced a slick split keyboard for thumb-typing. Unfortunately, I have some UI that is dependent on the normal full-screen keyboard layout. One

4条回答
  •  北荒
    北荒 (楼主)
    2020-12-13 11:48

    UIKeyboardFrameChangedByUserInteraction key does not return 1 all the time when keyboard splits.

    Below is the full user info dictionary key values on UIKeyboardDidShowNotification / UIKeyboardDidHideNotification.

    2012-07-11 11:52:44.701 Project[3856:707] keyboardDidShow: {
        UIKeyboardBoundsUserInfoKey = "NSRect: {{0, 0}, {1024, 352}}";
        UIKeyboardCenterBeginUserInfoKey = "NSPoint: {512, 944}";
        UIKeyboardCenterEndUserInfoKey = "NSPoint: {512, 592}";
        UIKeyboardFrameBeginUserInfoKey = "NSRect: {{-352, 0}, {352, 1024}}";
        UIKeyboardFrameChangedByUserInteraction = 0;
        UIKeyboardFrameEndUserInfoKey = "NSRect: {{0, 0}, {352, 1024}}";
    }
    
    2012-07-11 11:52:45.675 Project[3856:707] keyboardDidHide: {
        UIKeyboardBoundsUserInfoKey = "NSRect: {{0, 0}, {1024, 352}}";
        UIKeyboardCenterBeginUserInfoKey = "NSPoint: {512, 592}";
        UIKeyboardCenterEndUserInfoKey = "NSPoint: {512, 944}";
        UIKeyboardFrameBeginUserInfoKey = "NSRect: {{0, 0}, {352, 1024}}";
        UIKeyboardFrameChangedByUserInteraction = 0;
        UIKeyboardFrameEndUserInfoKey = "NSRect: {{-352, 0}, {352, 1024}}";
    }
    

    Instead you can use UIKeyboardCenterBeginUserInfoKey or UIKeyboardCenterEndUserInfoKey keys to get notified when keyboard splits.

    Hope this helps!

提交回复
热议问题