4

How can an iOS app know if a keyboard is already on the screen when the app opens? Once an app is running, it can receive keyboard show/hide notifications. But if the app opens as a secondary app in Split Screen mode while the primary app already has a keyboard showing, the secondary app does not receive any notifications to tell it to adjust its views for the keyboard. And as far as I can tell, these notifications are the only way to tell if a keyboard is showing and what its frame is, to then obtain the necessary layout constraints. Is there a way to get this information, or should a bug report be filed for this issue?

SAHM
  • 4,078
  • 7
  • 41
  • 77

1 Answers1

0

There is currently no way to detect if another app has the keyboard focus.

You might be able to make a workaround using Auto Layout though.

or this How to detect when keyboard is shown and hidden

Community
  • 1
  • 1
quemeful
  • 9,542
  • 4
  • 60
  • 69
  • It looks from my feed that you might have started to answer this by saying that the keyboard is auto-hidden each time the app goes into split screen mode. I see the beginning of that answer in my feed but I can't find the answer on this page. Is that the case? – SAHM May 17 '16 at 20:46
  • The keyboard is auto hidden, but if the keyboard was active in the first app, it will come back (still active in the first app) once the second has loaded. I just tried it on the iPad Pro simulator in XCode. – quemeful May 17 '16 at 20:48
  • I don't think it comes back with any notifications, am I correct? – SAHM May 17 '16 at 20:49
  • I don't see how it could. The notification, if any, would go to where the keyboard has focus (the app that was open already) – quemeful May 17 '16 at 20:50
  • check this out http://stackoverflow.com/questions/4374436/how-to-detect-when-keyboard-is-shown-and-hidden – quemeful May 17 '16 at 20:50
  • it might have the answer for you – quemeful May 17 '16 at 20:51