- (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工具栏(替换它们)?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)