简体   繁体   中英

Don't show ImagePicker in WKWebView iOS

I would like to have a WKWebView that does not display the ImagePicker but uses an image I have selected. Is something like this possible?

我想隐藏的选择器

This image picker show on Long press event. Just remove UILongPressGestureRecognizer from your webview. Use following wkwebview extension.

extension WKWebView {

/// disable long press on Wkwebview    
func removeLongTapGestures() {
    for subView in self.scrollView.subviews {
        if let recogniserz = subView.gestureRecognizers {
            for recogniser in recogniserz {
                if recogniser is UILongPressGestureRecognizer {
                    subView.removeGestureRecognizer(recogniser)
                }
            }
        }
    }
}

}

call this function removeLongTapGestures in webview didFinish delegate method.

webView.removeLongTapGestures()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM