UIWebView Bug: -[UIWebView cut:]: unrecognized selector sent to instance

后端 未结 4 1747
时光取名叫无心
时光取名叫无心 2021-02-04 03:43

In the UIWebView, if an input element containing text has focus, and a button is pressed that causes the input to lose focus, then subsequently double-tapping on th

4条回答
  •  我在风中等你
    2021-02-04 04:08

    - (UIView *)_internalView {
        UIView *internalView = nil;
    
        if (internalView == nil && self.subviews.count > 0) {
            for (UIView *view in self.scrollView.subviews) {
                if([view.class.description hasPrefix:@"UIWeb"]) {
                    internalView = view;
                    break;
                }
            }
        }
    
        return internalView;
    }
    
    - (id)forwardingTargetForSelector:(SEL)aSelector {
        struct objc_method_description methodDescription = protocol_getMethodDescription(@protocol(UIResponderStandardEditActions), aSelector, NO, YES);
    
        if (methodDescription.name == aSelector) {
            UIView *view = [self _internalView];
            if ([view respondsToSelector:aSelector]) {
                return view;
            }
        }
        return [super forwardingTargetForSelector:aSelector];
    }
    

提交回复
热议问题