【发布时间】:2013-09-16 21:23:04
【问题描述】:
我可以删除工具栏,但我的宽度与工具栏的高度模糊。
关于如何删除它的任何想法?
下面的代码是函数。这很简单。 我使用 phonegap 在 webview 中使用它。
-(void) removeBar {
// 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]) {
// iOS 5 sticks the UIWebFormView inside a UIPeripheralHostView.
if ([
[possibleFormView description] rangeOfString: @"UIPeripheralHostView"].location != NSNotFound) {
// remove the border above the toolbar in iOS 6
[
[possibleFormView layer] setMasksToBounds: YES];
for (UIView * subviewWhichIsPossibleFormView in [possibleFormView subviews]) {
if ([
[subviewWhichIsPossibleFormView description] rangeOfString: @"UIWebFormAccessory"].location != NSNotFound) {
[subviewWhichIsPossibleFormView removeFromSuperview];
// http://stackoverflow.com/questions/10746998/phonegap-completely-removing-the-black-bar-from-the-iphone-keyboard/10796550#10796550
UIScrollView * webScroll;
if ([
[
[UIDevice currentDevice] systemVersion] floatValue] >= 5.0) {
webScroll = [
[self webView] scrollView];
} else {
webScroll = [
[
[self webView] subviews] lastObject];
}
CGRect newFrame = [webScroll frame];
float accessoryHeight = [subviewWhichIsPossibleFormView frame].size.height;
newFrame.size.height += accessoryHeight;
[subviewWhichIsPossibleFormView removeFromSuperview];
[webScroll setFrame: newFrame];
}
}
}
}
}
如果您遇到此问题,请务必前往 https://bugreport.apple.com 并复制 rdar://9844216
【问题讨论】:
-
我已经添加了screenie :-)
-
您是否使用此代码在 iPhone 5s 上测试过您的应用程序?工作正常吗?
-
我找到了 iOS 8 的解决方案。你可以在这里查看:[ iOS 8 - Remove Previous/Next/Done UIKeyboard Toolbar inside a UIWebView][1] [1]: stackoverflow.com/questions/25022089/…跨度>
-
我找到了 iOS 8 的解决方案。你可以在这里查看:iOS 8 - Remove Previous/Next/Done UIKeyboard Toolbar inside a UIWebView stackoverflow.com/questions/25022089/…
标签: objective-c cordova ios7