2011-12-12 21 views
6

से पिछला अगला बटन कैसे निकालें IOS IOS में UIWebview का उपयोग किया है। मैं uiwebview संपादन योग्य बनाने के लिए contenteditable="true" सेट करने का प्रयास करता हूं।वर्चुअल कीबोर्ड आईओएस

मेरे ऐप्लिकेशन के screenshoot इस लिंक How do you remove the Next and Prev buttons from virtual keyboard in Sencha Touch/Phonegap application में एक छवि के समान है,

enter image description here

मेरी समस्या मैं कुंजीपटल से पिछला & अगले बटन निकालना चाहते है, लेकिन मुझे नहीं पता है कि। क्या कुछ शरीर मेरी मदद कर सकता है?

धन्यवाद

+0

मैं आईओएस 8. आप के लिए समाधान इसे यहां देख सकते हैं: आईओएस 8 - UIWebView के अंदर पिछला/अगला/संपन्न UIKeyboard टूलबार निकालें http://stackoverflow.com/questions/25022089/remove-next-previous-buttons-inputaccessoryview-for-custom-keyboard-in-ios8 – Gaurav

उत्तर

11

यह एक पुरानी जवाब है और iOS 9. पर काम कर रहे एक अद्यतन समाधान के लिए नहीं रह गया है, मेरा उत्तर here देखते हैं।


यह एक भूरे क्षेत्र, लेकिन निश्चित रूप से संभव है। अधिसूचना के लिए http://ios-blog.co.uk/iphone-development-tutorials/rich-text-editing-a-simple-start-part-1/

रजिस्टर कीबोर्ड दिखाया जा रहा पर:

यहाँ देखें

[[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 *possibleFormView in [keyboardWindow subviews]) {  
     // iOS 5 sticks the UIWebFormView inside a UIPeripheralHostView. 
     if ([[possibleFormView description] rangeOfString:@"UIPeripheralHostView"].location != NSNotFound) { 
      for (UIView *subviewWhichIsPossibleFormView in [possibleFormView subviews]) { 
       if ([[subviewWhichIsPossibleFormView description] rangeOfString:@"UIWebFormAccessory"].location != NSNotFound) { 
        [subviewWhichIsPossibleFormView removeFromSuperview]; 
       } 
      } 
     } 
    } 
} 
+0

यह एक खाली क्षेत्र छोड़ दिया जहां बार था, आप इसे कैसे हटाते हैं? – jAckOdE

+0

आप सामग्री को कम करने का प्रयास कर सकते हैं। –

+0

एचएम, मैंने आपके रास्ते की कोशिश नहीं की है, लेकिन मैंने पाया कि अगर मैं एक्सेसरी फॉर्म का फ्रेम "रिक्त आयत" पर सेट करता हूं तो यह काम करता है। – jAckOdE

3

खाली क्षेत्र निकालें।

- (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]) { 
     if ([[possibleFormView description] hasPrefix:@"<UIPeripheralHostView"]) { 
      for (UIView* peripheralView in [possibleFormView subviews]) { 

       // hides the backdrop (iOS 7) 
       if ([[peripheralView description] hasPrefix:@"<UIKBInputBackdropView"]) { 
        //skip the keyboard background....hide only the toolbar background 
        if ([peripheralView frame].origin.y == 0){ 
         [[peripheralView layer] setOpacity:0.0]; 
        } 
       } 
       // hides the accessory bar 
       if ([[peripheralView description] hasPrefix:@"<UIWebFormAccessory"]) { 
        // remove the extra scroll space for the form accessory bar 
        UIScrollView *webScroll; 
        if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 5.0) { 
         webScroll = [[self webView] scrollView]; 
        } else { 
         webScroll = [[[self webView] subviews] lastObject]; 
        } 
        CGRect newFrame = webScroll.frame; 
        newFrame.size.height += peripheralView.frame.size.height; 
        webScroll.frame = newFrame; 

        // remove the form accessory bar 
        [peripheralView removeFromSuperview]; 
       } 
       // hides the thin grey line used to adorn the bar (iOS 6) 
       if ([[peripheralView description] hasPrefix:@"<UIImageView"]) { 
        [[peripheralView layer] setOpacity:0.0]; 
       } 
      } 
     } 
    } 
} 
1

यह UIWebBrowserView के लिए inputAccessoryView (भीतरी UIWebView), आप इसे हैक कर सकता है।

यहाँ एक उदाहरण है: https://gist.github.com/bjhomer/2048571

+0

पिछले समाधानों की तुलना में अधिक क्लीनर। – ingaham

1

मैं आईओएस 8. के ​​लिए समाधान आप इसे यहाँ देख सकते हैं:

-(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; 

       } 
      } 

     } 
    } 
} 
} 

आप कोशिश करते हैं और इस सुधार हो सकता है। इस UI को अपने UIKeyboardDidShowNotification ईवेंट हैंडलर के अंदर कॉल करने का प्रयास करें।

आशा इस मदद करता है ... यह गौण में विचारों का स्तर है: (UIWebFormAccessory) -> (UIToolbar) -> (UIImageView, UIToolbarButton, UIToolbarButton)