My Step:
- I Get keyboard view from code below (GetKeyboardView)
- I Create custom view and then add to keyboard view form (1.)
I have question, Why it's work on iOS8 and bellow but not work in iOS9. Keyboard view is on top every view in iOS9. How to solve this problem? please suggest me.
Code for Get the keyboard view (it's work)
-(UIView *)GetKeyboardView{
// locate keyboard view
int windowCount = (int)[[[UIApplication sharedApplication] windows] count];
if (windowCount < 2) {
return nil;
}
UIWindow* tempWindow = [[[UIApplication sharedApplication] windows] objectAtIndex:1];
UIView* keyboard;
for(int i = 0 ; i < [tempWindow.subviews count] ; i++)
{
keyboard = [tempWindow.subviews objectAtIndex:i];
// keyboard found, add the button
if([[keyboard description] hasPrefix:@"<UIPeripheralHost"] == YES){
return keyboard;
}//This code will work on iOS 8.0
else if([[keyboard description] hasPrefix:@"<UIInputSetContainerView"] == YES){
for(int i = 0 ; i < [keyboard.subviews count] ; i++)
{
UIView* hostkeyboard = [keyboard.subviews objectAtIndex:i];
if([[hostkeyboard description] hasPrefix:@"<UIInputSetHost"] == YES){
return keyboard;
}
}
}
}
return nil;
}