Keyboard above custom UIWindow in iOS9

Before iOS9, a second UIWindow (with window level above UIWindowLevelNormal) on top of key app window covers all windows including keyboard. The view hierarchy shows that the keyboard is in UITextEffectsWindow.


However, the keyboard in iOS9 is in another window UIRemoteKeyboardWindow that sits on top of all other windows. There does not seem to be a trivial way to set the custom UIWindow above the keyboard. A solution is to manually dismiss/present keyboard when showing/hiding the custom window.


Is it an intended change in iOS9 that keyboard should be above all windows?

Replies

+1

I have the same problem and I don't want to resign the keyboard. Is there any solution to add view over keyboard?? I was using UIWindowLevelStatusBar for the overlay window

We are also having the same problem. In our case, we try to add custom view on top of the numeric keyboard and with beta and GM version, we do not see it. However, till iOS 8.4.1 everything works perfectly fine.

If I remember correctly, then it was the same observation in case of iOS 8 till GM versions.

I hope thats the same case with iOS 9 as well.

Otherwise, some one from Apple please help us to resolve the same.

+1


Have the same issue.

Opened radar: http://www.openradar.me/22715674

This is a work around for this problem:


NSArray *windows = [[UIApplication sharedApplication] windows];

if ([windows lastObject] != warningAlertView)

{

[[windows lastObject] addSubview:warningAlertView];

}

[warningAlertView makeKeyAndVisible];


Note: if you know the alert is going on top of the keyboard every single time, you don't need to check if the lastObject is equal to your alert. In my particular alert class, the alert can appear when the keyboard is present and when it's not. Anyway, try this out, it seems to work, I'm just not sure if there are any boundary cases that I'm not thinking of, maybe you guys can comment on that.

My workaround is following:


NSArray *windows = [[UIApplication sharedApplication] windows];
UIWindow *lastWindow = (UIWindow *)[windows lastObject];
myWindow.windowLevel = lastWindow.windowLevel + 1;


myWindow is a UIWindow that should appear above the keyboard

@dim-non This works as well. One problem I've found with both solutions is now rotation isn't locked on the keyboard, so the user will be able to rotate the device when the alert pops up which shouldn't happen.

Very nice! Why does Apple have to make things so difficult?