iphone – 如何在iOS 6上找到UIWebView工具栏(替换它们)?

iphone – 如何在iOS 6上找到UIWebView工具栏(替换它们)?,第1张

概述我从另一个应用程序尝试了以下代码,但它没有找到任何东西.为什么?如何访问UIWebView工具栏? - (UIToolbar *)findVirginWebKeyboardToolbar:(UIView *)parent{ if ([parent isKindOfClass:[UIToolbar class]]) { UIToolbar *tb = (UIToolbar 我从另一个应用程序尝试了以下代码,但它没有找到任何东西.为什么?如何访问UIWebVIEw工具栏?

- (UIToolbar *)findVirginWebKeyboardToolbar:(UIVIEw *)parent{    if ([parent isKindOfClass:[UIToolbar class]]) {        UIToolbar *tb = (UIToolbar *)parent;        if ([tb.items count] == 1 && [((UIbarbuttonItem *)[tb.items objectAtIndex:0]).customVIEw isKindOfClass:[UISegmentedControl class]]) {            return tb;        }    }    for (UIVIEw *vIEw in parent.subvIEws) {        UIToolbar *tb = [self findVirginWebKeyboardToolbar:vIEw];        if (tb) return tb;    }    return nil;}- (voID)removeKeyboardbar {    UIVIEw *keyboarDWindow = nil;    for (UIWindow *testwindow in [[UIApplication sharedApplication] windows]) {        keyboarDWindow = testwindow;        UIToolbar *toolbar = [self findVirginWebKeyboardToolbar:keyboarDWindow/*subvIEwWhichIsPossibleFormVIEw*/];        if (toolbar) {            itemsArray = [NSArray arrayWithObjects:button1,button2,button3,nil];            [toolbar setItems:itemsArray];        }    }}
解决方法 使用以下代码,您应该能够删除键盘上方的工具栏.

-(voID)vIEwWillAppear:(BOol)animated{  [[NSNotificationCenter defaultCenter] addobserver:self                                        selector:@selector(keyboarDWillShow:)                                            name:UIKeyboarDWillShowNotification                                          object:nil];}- (voID)keyboarDWillShow:(NSNotification *)note {  [self performSelector:@selector(removebar) withObject:nil afterDelay:0];}- (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 *formVIEw in [keyboarDWindow subvIEws]) {  // iOS 5 sticks the UIWebFormVIEw insIDe a UIPeripheralHostVIEw.  if ([[formVIEw description] rangeOfString:@"UIPeripheralHostVIEw"].location != NSNotFound) {    for (UIVIEw *subVIEw in [formVIEw subvIEws]) {        if ([[subVIEw description] rangeOfString:@"UIWebFormAccessory"].location != NSNotFound) {            // remove the input accessory vIEw            [subVIEw removeFromSupervIEw];        }        else if([[subVIEw description] rangeOfString:@"UIImageVIEw"].location != NSNotFound){            // remove the line above the input accessory vIEw (changing the frame)            [subVIEw setFrame:CGRectZero];        }    }  }}}
总结

以上是内存溢出为你收集整理的iphone – 如何在iOS 6上找到UIWebView工具栏(替换它们)?全部内容,希望文章能够帮你解决iphone – 如何在iOS 6上找到UIWebView工具栏(替换它们)?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1085875.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-27
下一篇 2022-05-27

发表评论

登录后才能评论

评论列表(0条)

保存