Remove Next / Previous buttons (inputAccessoryView) for Custom Keyboard in iOS8 WebView(删除 iOS8 WebView 中自定义键盘的下一个/上一个按钮 (inputAccessoryView))
问题描述
请多多包涵,我在互联网上搜索了很多,但我找不到解决方案,因为它是一个新的 API.
Please bear with me, I searched a lot over the internet and I couldn't find a solution since it's a new API.
我正在尝试为 iOS 8 创建一个自定义键盘.除了在 WebView 中之外,它工作得非常好!它具有上一个-下一个按钮,位于 inputAccessoryView
中.我知道它是 webview 的只读属性,但由于 iOS 8 允许用户使用自定义键盘,我认为这个视图应该可以在某处进行编辑.有没有人遇到同样的问题?任何帮助将不胜感激.
I am trying to create a custom keyboard for iOS 8. It works perfectly fine except in WebView!
It has previous-next button, which are in inputAccessoryView
. I know it's read-only property for webview but since iOS 8 allows the users to have custom keyboard I assume this view should be editable somewhere. Has anybody run into the same issue? Any help would be appreciated.
推荐答案
您可以尝试改进它.尝试在您的 UIKeyboardDidShowNotification 事件处理程序中调用此函数.
You may try and improve this. try call this function inside Your UIKeyboardDidShowNotification event handler.
-(void) removeKeyboard {
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 (UIView* peripheralView in possibleFormView.subviews) {
for (UIView* peripheralView_sub in peripheralView.subviews) {
// hides the backdrop (iOS 8)
if ([[peripheralView_sub description] hasPrefix : @"<UIKBInputBackdropView"] && peripheralView_sub.frame.size.height == 44) {
[[peripheralView_sub layer] setOpacity : 0.0];
}
// hides the accessory bar
if ([[peripheralView_sub description] hasPrefix : @"<UIWebFormAccessory"]) {
for (UIView* UIInputViewContent_sub in peripheralView_sub.subviews) {
CGRect frame1 = UIInputViewContent_sub.frame;
frame1.size.height = 0;
peripheralView_sub.frame = frame1;
UIInputViewContent_sub.frame = frame1;
[[peripheralView_sub layer] setOpacity : 0.0];
}
CGRect viewBounds = peripheralView_sub.frame;
viewBounds.size.height = 0;
peripheralView_sub.frame = viewBounds;
}
}
}
}
}
}
希望这会有所帮助...
Hope this helps...
这是附件中的视图级别:
This is the level of views in accessory:
(UIWebFormAccessory) ->(UI工具栏)->(UIImageView,UIToolbarButton,UIToolbarButton)
(UIWebFormAccessory) -> (UIToolbar) -> (UIImageView,UIToolbarButton,UIToolbarButton)
移除或缩放到零高度的辅助栏将导致黑色区域.您可以围绕主视图的框架或边界进行播放.或者如果您只是想摆脱按钮,只需尝试在 UIToolbutton 上设置 0 不透明度,工具按钮位于 uitoolbar 视图中
Removing or scaling to zero height the accessory bar will cause black area. You can play around the mainview's frame or bounds. or if You just want to get rid of the buttons, just try to have a 0 opacity on the UIToolbutton , the toolbutton is inside uitoolbar view
这篇关于删除 iOS8 WebView 中自定义键盘的下一个/上一个按钮 (inputAccessoryView)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:删除 iOS8 WebView 中自定义键盘的下一个/上一个按
基础教程推荐
- 当从同一个组件调用时,两个 IBAction 触发的顺序是什么? 2022-01-01
- Kivy Buildozer 无法构建 apk,命令失败:./distribute.sh -m “kivy"d 2022-01-01
- 如何让对象对 Cocos2D 中的触摸做出反应? 2022-01-01
- 如何在没有IB的情况下将2个按钮添加到右侧的UINavigationbar? 2022-01-01
- Android:对话框关闭而不调用关闭 2022-01-01
- 如何在 iPhone 上显示来自 API 的 HTML 文本? 2022-01-01
- 在 gmail 中为 ios 应用程序检索朋友的朋友 2022-01-01
- UIWebView 委托方法 shouldStartLoadWithRequest:在 WKWebView 中等效? 2022-01-01
- android 应用程序已发布,但在 google play 中找不到 2022-01-01
- 如何在 UIImageView 中异步加载图像? 2022-01-01