I want to get a pointer reference to UIKeyboard *keyboard
to the keyboard on screen so that I can add a transparent subview to it, covering it completely, to ac
I found that developerdoug's answer wasn't working on iOS 7, but by modifying things slightly I managed to get access to what I needed. Here's the code I used:
-(UIView*)findKeyboard
{
UIView *keyboard = nil;
for (UIWindow* window in [UIApplication sharedApplication].windows)
{
for (UIView *possibleKeyboard in window.subviews)
{
if ([[possibleKeyboard description] hasPrefix:@"
From what I could make out, in iOS 7 the keyboard is composed of a UIPeripheralHostView
containing two subviews: a UIKBInputBackdropView
(which provides the blur effect on whatever's underneath the keyboard) and a UIKeyboardAutomatic
(which provides the character keys). Manipulating the UIPeripheralHostView
seems to be equivalent to manipulating the entire keyboard.
Discaimer: I have no idea whether Apple will accept an app that uses this technique, nor whether it will still work in future SDKs.