问题描述
请多多包涵,我在互联网上搜索了很多,但我找不到解决方案,因为它是一个新的 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)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!


大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)