Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>There is another level to this. </p> <ul> <li>If you don't have an inputAccessoryView, you won't get the notification as the above explanations point out.</li> <li>However, if you have set up an inputAccessoryView for the text view, then you will still receive a UIKeyboard notification when the external kbd is present -- the logic being that you will need to animate your view into the right location so you need the animation information contained in the notification. </li> </ul> <p>Fortunately, there is enough information in the event to figure out whether the kbd will be presented, though it's still a little involved.</p> <p>If we examine the notification dictionary we see this information:</p> <pre><code>UIKeyboardFrameBeginUserInfoKey = NSRect: {{0, 1024}, {768, 308}} UIKeyboardFrameEndUserInfoKey = NSRect: {{0, 980}, {768, 308}} </code></pre> <p>That was in Portrait; if we rotate the device to PortraitUpsideDown we get:</p> <pre><code>UIKeyboardFrameBeginUserInfoKey = NSRect: {{0, -308}, {768, 308}} UIKeyboardFrameEndUserInfoKey = NSRect: {{0, -264}, {768, 308}} </code></pre> <p>Similarly in LandscapeLeft and LandscapeRight we get different start and end locations.</p> <p>Hmm... what do these numbers mean? You can see that the kbd is offscreen to start, but it does move a little. To make things worse, depending on the device orientation, the kbd locations are different. </p> <p>However, we do have enough information to figure out what's going on:</p> <ol> <li>The kbd moves from just offscreen at the physical bottom of the device to the same height as the inputAccessoryView (but obscured by it)</li> <li>So in the Portrait case it moves from 1024 to 980 -- we must have an inputAccessoryView with a height of 44, which is indeed the case.</li> <li>So in Portrait if the end y + the inputAccessoryView height == screen height, then the kbd is not visible. You need to handle the other rotations, but that's the idea.</li> </ol>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload