问题
I am working on a app in which I have removed the back drop of keyboard using this code in iOS8 with iPhone 5:
- (void)removeKeyboardTopBar {
// Locate non-UIWindow.
UIWindow *keyboardWindow = nil;
for (UIWindow *testWindow in [[UIApplication sharedApplication] windows]) {
if (![[testWindow class] isEqual:[UIWindow class]]) {
keyboardWindow = testWindow;
break;
}
}
// Locate UIWebFormView.
for (UIView *possibleFormView in [keyboardWindow subviews])
{
if([[possibleFormView description] hasPrefix:@"<UIInputSetContainerView"])
{
for(int i = 0 ; i < [possibleFormView.subviews count] ; i++)
{
UIView* hostkeyboard = [possibleFormView.subviews objectAtIndex:i];
if([[hostkeyboard description] hasPrefix:@"<UIInputSetHostView"])
{
for (id temp in hostkeyboard.subviews)
{
if ([[temp description] hasPrefix:@"<UIKBInputBackdropView"])
{
[[temp layer] setOpacity:0.0];
}
if ([[temp description] hasPrefix:@"<UIWebFormAccessory"])
{
[temp removeFromSuperview];
}
if ([[temp description] hasPrefix:@"<UIImageView"])
{
[[temp layer] setOpacity:0.0];
}
}
}
}
}
}
It is working fine in iPhone 5 with iOS8.But now I have tested it on iPhone 5s with iOS8 and it is not working fine the back drop is removed but it has not hides the accessory bar and crash when we touch the keyboard buttons. Please advice if anybody has face this issue. I have already searched a lot but can't find a solution. Thanks in advance.
来源:https://stackoverflow.com/questions/26213708/remove-back-drop-accessory-bar-of-keyboard-in-iphone-5s-with-ios-8